home *** CD-ROM | disk | FTP | other *** search
- /*
- ****************************************************************************
- *Copyright 1992 Regents of The University of Michigan - All Rights Reserved*
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, *
- * provided that the above copyright notice appears in all copies and that *
- * both that copyright notice and this permission notice appear in *
- * supporting documentation, and that the name of The University of Michigan*
- * not be used in advertising or publicity pertaining to distribution of *
- * the software without specific, written prior permission. This software *
- * is supplied as is without expressed or implied warranties of any kind. *
- * *
- * Center for Information Technology Integration *
- * Information Technology Division *
- * The University of Michigan *
- * 519 W. William Street *
- * Ann Arbor, Michigan 48103 *
- * +1 313-764-5440 *
- * FAX: +1 313-764-4434 *
- * info@citi.umich.edu *
- * *
- ****************************************************************************
- */
-
- /* version modified 10-13-92 for bug fixes, enhancements suggested by Robert John C., etc. */
-
- #include <AppleTalk.h>
- #include <Balloons.h>
- #include <Types.h>
- #include <Files.h>
- #include <Devices.h>
- #include <Quickdraw.h>
- #include <OSUtils.h>
- #include <CType.h>
- #include <Dialogs.h>
- #include <Desk.h>
- #include <Icons.h>
- #include <Errors.h>
- #include <Resources.h>
- #include <Lists.h>
- #include <Memory.h>
- #include <SysEqu.h>
- #include <Packages.h>
- #include <ToolUtils.h>
- #include <StdIO.h>
- #include <String.h>
- #include <Fonts.h>
- #include <GestaltEqu.h>
- #include <Menus.h>
- #include <Sound.h>
- #include <Traps.h>
- #include <Windows.h>
- #include <Quickdraw.h>
- #include "Protos.h"
- #include "AShare.h"
- #include "CursorCtl.h"
-
- #include "xvcb.h"
- #include "privileges.h"
-
- #define DEBUG 0
- #define kOn 1
- #define kOff 0
-
- typedef short SICN[16];
- typedef SICN *SICNList;
- typedef SICNList *SICNHand;
-
- void quickcheck( short howmany );
-
- extern void showInfoDialog( void );
-
- pascal void firstBox( WindowPtr, short );
- pascal void secondBox( WindowPtr, short );
- pascal void bonusBox( WindowPtr, short );
- pascal void growBox( WindowPtr, short );
- pascal void popupBox( WindowPtr, short );
- pascal void newpopupBox( WindowPtr, short );
- pascal void posornegBox( WindowPtr, short );
- pascal void negativeBox( WindowPtr, short );
- Boolean getdirAcl( short, long );
- StringHandle getMacName( void );
- short CompareandInsert( char listentry[255], char, short );
- void gotoToplevel( void );
- void shouldireallyquit( void );
- void genericErrorstuff( long, short, short );
- void deleteNegAclBox( void );
- void createNegAclBox( void );
- void sneakyNegative( long );
- void noAFSmounted( void );
- void makedirList( Str255 path, long vRefNum );
- void showRights( short whichOne );
- void bzero( char *p, long len );
- void buildACL( void );
- void termiNate( void );
- void makeList( void );
- void eventLoop( void );
- void dirSelect( short );
- void aclSelect( short );
- void negSelect( short );
- void doMenu( long );
- void doDialog( short );
- void addGroup( void );
- void deleteGroup( void );
- void resetPerm( short, short, short );
- void aboutPriv( void ) ;
- void instagroovyAcls( short );
- void setupPopup( void ); // for system 5, 6 or so.... NOT 7...
- OSErr GetIndVolume( short, char *volName, short *volRefNum);
-
- /* GLOBALS!! */
- AVCB *vcb;
- EventRecord er;
- ListHandle dirList, /* the drive/directory list */
- gourList, /* the positive acl list */
- gnegAcls, /* negative acls end up in here */
- gpathList; /* pathList is used to piece together the path and popupmenu */
- MenuHandle gApplemenu, gFilemenu, gOptions, gSetmenu, gPopupMenu;
- DialogPtr dp, dr;
- Handle gWatchCursor;
- HParamBlockRec gWhereweare;
- Rect gsizeDialrect;
- Str255 gAclName; /* the name that appears in the add group function */
- WStateData gWindowsize;
- short gItem, gTopLevel = 0, /* this is the position on the path we're focused on */
- gManyAcls = 0, gAChange = kOff,
- gInitialize = kOff, gLocation = 0;
-
- struct{
- short State, /* 0 for positive only mode, 1 for pos/neg mode */
- Focus, /* focus 0 for left box, 1 for right box */
- Permit; /* are we permitted to change acls on this directory? */
- } gWindowstats;
-
- #define popupMenuCDEFProc 1008
- #ifndef popupPrivateData
- struct popupPrivateData{
- MenuHandle mHandle; // handle to menu
- short mID; // menu ID
- SignedByte mPrivate[];
- };
-
- typedef struct popupPrivateData popupPrivateData;
- #endif
-
- main( )
- {
- Boolean helpmanager;
- FontInfo fontStuff;
- MenuHandle editmenu, helpmenu;
- Handle nothingspecial, ditlhandle, xdef;
- OSErr err;
- StringPtr nameofmac;
- StringHandle somethingtypestring;
- Rect rView = { 27, 9, 169, 9+163-15 }, /* for drive/volume list */
- sView = { 25, 182, 25+107+5, 182+163-15 },
- tView = RECT_POPUPMENU,
- uView = { 0, 0, 0, 0 },
- firstbox = { 27-1, 9-1, 167+6, 9+163+1 }, /* for drive/volume list */
- secondbox = { 25-1, 182-1, 25+107+6, 182+163+1 },
- dataBounds = { 0, 0, 0, 2 },
- box = { 0, 0, 0, 0},
- popupbox = RECT_POPUPMENU,
- dialogRect = kmainDialogboxsize,
- /* two column list here.. one column for name, one for */
- /* MAGIC top secret -- acl -- number */
- boxit;
- Point nothing = { 0 , 0 }, /* just that */
- something = { 0, 0 };
- long newpopupAvailable;
- short boxthebutton, fontNum;
- Cell cSize;
- int theRow, gestalterror, myBit;
-
- MaxApplZone();
- InitGraf((Ptr) &qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(NULL);
- InitCursor();
-
- gTopLevel = 0; /* level 1 is for the desktop */
-
- gWindowsize.stdState.top = 40;
- gWindowsize.stdState.left = 40;
- gWindowsize.stdState.bottom = ( 40+170 );
- gWindowsize.stdState.right = ( 40+425 );
- gWindowsize.userState = gWindowsize.stdState ;
-
- gWindowstats.State = 0;
- gWindowstats.Focus = 0;
- gWindowstats.Permit = 0;
-
- if (( gApplemenu = GetMenu(MENU_APPLE)) == NULL ) {
- /* bombs out */
- termiNate ;
- }
-
- if (( gFilemenu = GetMenu(MENU_FILE)) == NULL ) {
- termiNate ;
- }
-
- if (( gOptions = GetMenu(MENU_OPTION )) == NULL ) {
- termiNate ;
- }
-
- if (( gSetmenu = GetMenu( MENU_CONVIN )) == NULL ) {
- termiNate ;
- }
-
- if (( editmenu = GetMenu(MENU_EDIT)) == NULL ) {
- termiNate ;
- }
-
- gWatchCursor = GetResource( 'acur', ACUR_SPIN );
-
- InsertMenu ( gApplemenu, 0);
- InsertMenu ( gFilemenu, 0);
- InsertMenu ( editmenu, 0);
- InsertMenu ( gSetmenu, -1 ); // this one is hierarchial...
- InsertMenu ( gOptions, 0 );
-
- gestalterror = Gestalt( gestaltHelpMgrAttr, &newpopupAvailable );
- if ( gestalterror == noErr ) {
- myBit = gestaltHelpMgrPresent;
- helpmanager = BitTst( &newpopupAvailable, 31-myBit );
- }
-
- if ( helpmanager == true ){
- err = HMGetHelpMenuHandle( &helpmenu );
- if( err == noErr ){
- if( helpmenu != NIL ){
- AppendMenu( helpmenu, "\pAFS Privileges Help" );
- }
- }
- }
-
- AddResMenu (gApplemenu ,'DRVR') ; /* adding DA's */
- DrawMenuBar();
-
- ditlhandle = GetResource( 'DITL', DITL_PRIV );
- if( ditlhandle == NULL ) genericErrorstuff( -66670, kOff, 108 );
-
- if (( dp = NewDialog( nil, &dialogRect, "\pAFS Privileges", true,
- zoomDocProc, (WindowPtr)-1, true, 0, ditlhandle )) == NULL ){
- genericErrorstuff( -66670, kOff, 109 );
- ExitToShell();
- }
-
- SetPort( dp );
-
- InitCursorCtl( (acurHandle) gWatchCursor ) ;
- Show_Cursor( ARROW_CURSOR );
- HideDItem( dp, ITEM_NEGBOX );
- HideDItem( dp, ITEM_NEGTITLE );
- Show_Cursor((Cursors) ACUR_SPIN);
-
- if (( xdef = Get1Resource( 'MDEF', wideMenuProc )) == NULL ) {
- genericErrorstuff( -66670, kOff, 110 );
- return( -1 );
- }
-
- if (( gPopupMenu = NewMenu( MENU_POPUP, "\pnothing")) == NULL ) termiNate( );
- (*gPopupMenu)->menuProc = xdef;
- AppendMenu( gPopupMenu, "\pDesktop" );
- GetDItem( dp, ITEM_POPUPMENU, &boxthebutton, ¬hingspecial, &boxit );
- SetDItem( dp, ITEM_POPUPMENU, boxthebutton, (Handle)popupBox, &boxit );
-
- SetItemCmd( gPopupMenu, 1, 0x1e );
- SetItemIcon( gPopupMenu, 1, SICN_DESK-256 ); // give the desktop icon to the DESKTOP entry!
- ShowWindow( dp );
- SpinCursor( 8 );
- ClipRect( &box );
-
- GetFNum((StringPtr)"\pChicago",&fontNum); /* set our font */
- TextFont(fontNum);
- TextFace(0);
- TextSize(12);
- GetFontInfo( &fontStuff );
- something.v = nothing.v = fontStuff.ascent+fontStuff.descent+fontStuff.leading;
- nothing.h = rView.right - rView.left;
- something.h = sView.right - sView.left;
-
- if (( gourList = LNew( &sView, &dataBounds, something, 0, dp, true, false, false, true )) == NULL ) {
- genericErrorstuff( -66670, kOff, 111 );
- }
- (*gourList)->selFlags = lOnlyOne | lNoNilHilite;
-
- if (( dirList = LNew( &rView, &dataBounds, nothing, 0, dp, true, false, false, true )) == NULL ) {
- genericErrorstuff( -66670, kOff, 112 );
- }
- (*dirList)->selFlags = lOnlyOne | lNoNilHilite;
- SpinCursor( 8 );
-
- if (( gnegAcls = LNew( &sView, &dataBounds, something, 0, dp, false, false, false, true )) == NULL ) {
- genericErrorstuff( -66670, kOff, 113 );
- }
- (*gnegAcls)->selFlags = lOnlyOne | lNoNilHilite;
-
- if (( gpathList = LNew( &tView, &dataBounds, nothing, 0, dp, false, false, false, false )) == NULL ) {
- genericErrorstuff( -66670, kOff, 114 );
- }
-
- theRow = LAddRow(1, 2000, gpathList); /* theRow should always be zero */
- cSize.h = 0;
- cSize.v = theRow;
- LSetCell("Desktop", 7, cSize, gpathList);
-
- GetDItem( dp, ITEM_FIRSTBOX, &boxthebutton, ¬hingspecial, &boxit );
- SetDItem( dp, ITEM_FIRSTBOX, boxthebutton, (Handle)firstBox, &boxit );
- GetDItem( dp, ITEM_SECONDBOX, &boxthebutton, ¬hingspecial, &boxit );
- SetDItem( dp, ITEM_SECONDBOX, boxthebutton, (Handle)secondBox, &boxit );
- GetDItem( dp, ITEM_GROWBOX, &boxthebutton, ¬hingspecial, &boxit );
- SetDItem( dp, ITEM_GROWBOX, boxthebutton, (Handle)growBox, &boxit );
- GetDItem( dp, ITEM_POSITIVE, &boxthebutton, ¬hingspecial, &boxit );
- SetDItem( dp, ITEM_POSITIVE, boxthebutton, (Handle)posornegBox, &boxit );
- SpinCursor( 8 );
-
- bzero( (char *)&gWhereweare, sizeof( HParamBlockRec ));
- gWhereweare.fileParam.ioCompletion = 0;
- gWhereweare.fileParam.ioVRefNum = 0;
- gWhereweare.fileParam.ioFDirIndex = 0;
- gWhereweare.fileParam.ioDirID = 0;
-
- nameofmac = gAclName;
- somethingtypestring = getMacName(); /* get the name of this macintosh */
-
- strncpy( nameofmac, *somethingtypestring, (int)(**somethingtypestring)+1);
-
- ClipRect( &dp->portRect);
- InvalRect( &dp->portRect );
- SpinCursor( 8 );
-
- makeList( );
- gInitialize = kOn;
- gsizeDialrect = dp->portRect;
- Show_Cursor( ARROW_CURSOR );
- eventLoop () ;
- } /* end main */
-
- void termiNate()
- {
- WindowPtr aWindow;
- Boolean closed;
-
- closed = true;
- do {
- aWindow = FrontWindow(); /* get the current front window */
- if (aWindow != nil)
- CloseWindow(aWindow); /* close this window */
- }
- while (aWindow != nil);
- if (closed)
- ExitToShell(); /* exit if no cancellation */
- ExitToShell();
- } /*termiNate*/
-
- void setupPopup( void ){
- if (( gPopupMenu = NewMenu( MENU_POPUP, "\pnothing")) == NULL ) {
- termiNate ;
- }
- AppendMenu( gPopupMenu, "\pDesktop" );
- }
-
- #pragma segment utils
-
- void genericErrorstuff( long anerror, short kontinue, short whereisit ){
-
- Handle number;
- Rect numberbox;
- char duh[32];
- short okbuttontype, itemHit;
-
- if (( dr = GetNewDialog( DLOG_ERROR, NULL, (WindowPtr)-1 )) == NULL ) {
- genericErrorstuff( -66670, kOff, 120 );
- ExitToShell();
- }
-
- SetPort( dr );
- ShowWindow( dr );
- GetDItem( dr, 7, &okbuttontype, &number, &numberbox );
-
- NumToString( whereisit, &duh );
- SetIText( number, &duh );
- GetDItem( dr, 3, &okbuttontype, &number, &numberbox );
-
- NumToString( anerror, &duh );
- SetIText( number, &duh );
-
- if ( kontinue == kOff ) {
- GetDItem( dr, 2, &okbuttontype, &number, &numberbox );
- HiliteControl((ControlHandle)number, 255 );
- }
-
- GetDItem( dr, 1, &okbuttontype, &number, &numberbox );
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
- SysBeep( 0 );
- ModalDialog( nil, &itemHit );
- switch( itemHit ) {
- case 1 : /* hit the Quit button */
- DisposDialog( dr );
- termiNate( );
- break;
- case 2 : /* hit the Continue button */
- DisposDialog( dr );
- return;
- break;
- }
- }
-
- StringHandle getMacName( void )
- {
- StringHandle macName;
- short saveResFile;
-
- saveResFile = CurResFile();
- UseResFile(0);
- macName = (StringHandle)Get1Resource('STR ', rUserName);
- if ((!macName) || (!(**macName)))
- macName = (StringHandle)Get1Resource('STR ', rMacintoshName);
-
- UseResFile(saveResFile);
- if ((!macName) || (!(**macName)))
- macName = (StringHandle)GetResource('STR ', rDefaultName);
- return(macName);
- }
-
- void noAFSmounted( void )
- {
- SysBeep( 0 );
- CautionAlert( ALRT_NOAFS, nil );
- termiNate( );
- }
-
- void sneakyNegative( long bigSize ) {
- char whatisit[50];
-
- SysBeep( 0 );
- NumToString( bigSize, whatisit+1 );
- whatisit[0] = strlen( whatisit+1 );
- // I guess we should add some code to put "whatisit" into the alrt... i.e.
- // this alrt needs to become a modal dialog...
-
- CautionAlert( ALRT_BOGNEG, nil );
- return;
- }
-
-
-
- #pragma segment privileges
-
- void parseStr(buffer)
- char *buffer;
- {
- int numPos, numNeg, i;
- long offset;
- char first[50];
- int value;
- Point cSize;
- int j;
- int theRow;
- char k;
- int flagofDOOM = 0;
-
- sscanf(buffer, "%d\n%d", &numPos, &numNeg);
- buffer = strchr(buffer, 10) + 1;
- buffer = strchr(buffer, 10) + 1;
- for (i = numPos; i >0; i--)
- {
- SpinCursor( 8 );
- sscanf(buffer, "%s %d", first, &value);
- theRow = LAddRow(1, 2000, gourList);
- cSize.h = 0;
- cSize.v = theRow;
- offset = strlen(first);
- LSetCell(&first, offset, cSize, gourList);
- cSize.h = 1;
- j = 1;
- k = value;
- LSetCell(&k, j, cSize, gourList);
- buffer = strchr(buffer, 10) + 1;
- }
- cSize.h = 0;
- cSize.v = 0;
- LSetSelect( true, cSize, gourList );
- if (( gWindowstats.State == 1 ) && ( numNeg <= 0 )) {
- deleteNegAclBox( );
- }
- if ( numNeg > 0 ) {
- for (i = numNeg; i > 0; i--) {
- SpinCursor( 8 );
- sscanf(buffer, "%s %d", first, &value);
- theRow = LAddRow(1, 2000, gnegAcls);
- cSize.h = 0;
- cSize.v = theRow;
- offset = strlen(first);
- LSetCell(&first, offset, cSize, gnegAcls);
- cSize.h = 1;
- j = 1;
- k = value;
- LSetCell(&k, j, cSize, gnegAcls);
- buffer = strchr(buffer, 10) + 1;
- }
- cSize.h = 0;
- cSize.v = 0;
- if ( gWindowstats.State == 0 ) {
- createNegAclBox( );
- }
- }
- }
-
- void showRights( short whichOne )
- {
- int count, i = 0;
- long j;
- Handle rights[8];
- Point theCell;
- Rect boxit;
- short boxthebutton, k = 1;
- char um;
-
- for ( count=0; count<7; count++) {
- GetDItem( dp, RIGHTS+count, &boxthebutton, &rights[count], &boxit );
- }
- theCell.v = whichOne ; /* hmmmmmmmm */
- k = 1;
- theCell.h = 0;
-
- if ( gWindowstats.Focus == 2 ) {
- if( LGetSelect( true, &theCell, gnegAcls ) == false ) goto zero;
- theCell.h = 1;
- LGetCell( &um, &k, theCell, gnegAcls );
- } else if ( gWindowstats.Focus == 1 ){
- if( LGetSelect( true, &theCell, gourList ) == false ) goto zero;
- theCell.h = 1;
- LGetCell( &um, &k, theCell, gourList );
- } else {
-
- /* well here we have a focus on the drive/dir list,
- * so we must figure out which one of the
- * two lists has something selected and then show those rights..*/
- if ( LGetSelect( true, &theCell, gourList ) == false ) {
- if( LGetSelect( true, &theCell, gnegAcls ) == false ){
- goto zero;
- }
- theCell.h = 1;
- LGetCell( &um, &k, theCell, gnegAcls );
- } else {
- theCell.h = 1;
- LGetCell( &um, &k, theCell, gourList );
- }
- }
- i = um;
-
- zero: for (j=0; j<7; j++)
- {
- if ( i & ( 1<<j ))
- SetCtlValue( (ControlHandle) rights[j], 1 );
- else
- SetCtlValue( (ControlHandle) rights[j], 0 );
- }
- }
-
- void addGroup( )
- {
- /* the options dialog box for create/deleting files */
-
- short itemHit = 0, type, theRow;
- long offset;
- int j;
- Point cSize;
- DialogPtr da;
- Handle groupname, okbutton;
- Rect numberbox;
- char nameofinterest[255], k;
- Cell whatcell = { 0, 0 }, oldcell = { 0, 0 };
-
- if (( da = GetNewDialog( DLOG_ADD, NULL, (WindowPtr)-1 )) == NULL ) {
- genericErrorstuff( 87, 0, 1 );
- ExitToShell();
- }
-
- SetPort( da );
- ShowWindow( da );
-
- GetDItem( da, ITEM_ADDGROUPEDIT, &type, &groupname, &numberbox );
- GetDItem( da, ITEM_OK, &type, &okbutton, &numberbox);
-
- SetIText( groupname, gAclName ); /* the chooser/owner name would be cool here */
- SelIText( da, ITEM_ADDGROUPEDIT, 0, 32767 );
-
- if( LGetSelect( true, &whatcell, dirList ) == false ) {
- genericErrorstuff( 90002, kOn, 2 );
- whatcell.v = 0;
- whatcell.h = 0;
- }
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
-
- for (;;) {
- ModalDialog( nil, &itemHit );
- switch( itemHit ) {
- case ITEM_OK : /* hit the OK button */
- GetIText( groupname, &nameofinterest );
- if ( gWindowstats.Focus == 2 ) {
- LDoDraw( false, gnegAcls );
- theRow = LAddRow(1, 2000, gnegAcls);
- cSize.h = 0;
- cSize.v = theRow;
- offset = strlen( &nameofinterest );
- LSetCell(&nameofinterest+1, nameofinterest[0], cSize, gnegAcls);
- cSize.h = 1;
- j = 1;
- k = 0; /* DEFAULT ACL VALUE */
- LSetCell( &k, j, cSize, gnegAcls );
- if ( LGetSelect( true, &oldcell, gourList ) == true ) LSetSelect( false, oldcell, gourList );
- oldcell.h = 0;
- oldcell.v = 0;
- if ( LGetSelect( true, &oldcell, gnegAcls ) == true ) LSetSelect( false, oldcell, gnegAcls );
- cSize.h = 0;
- LSetSelect( true, cSize, gnegAcls );
- DisposDialog( da );
- SetPort( dp );
- gAChange = whatcell.v+1; /* tell buildACL to change the acl.. */
- LDoDraw( true, gnegAcls );
- InvalRect( &(*gnegAcls)->rView );
- showRights( 0 );
- return;
- } else {
- LDoDraw( false, gourList );
- theRow = LAddRow(1, 2000, gourList);
- cSize.h = 0;
- cSize.v = theRow;
- offset = strlen( &nameofinterest );
- LSetCell(&nameofinterest+1, nameofinterest[0], cSize, gourList);
- cSize.h = 1;
- j = 1;
- k = 0; /* DEFAULT ACL VALUE */
- LSetCell( &k, j, cSize, gourList );
- if ( LGetSelect( true, &oldcell, gnegAcls ) == true ) LSetSelect( false, oldcell, gnegAcls );
- oldcell.h = 0;
- oldcell.v = 0;
- if ( LGetSelect( true, &oldcell, gourList ) == true ) LSetSelect( false, oldcell, gourList );
- cSize.h = 0;
- LSetSelect( true, cSize, gourList );
- DisposDialog( da );
- SetPort( dp );
- gAChange = whatcell.v+1; /* tell buildACL to change the acl.. */
- LDoDraw( true, gourList );
- InvalRect( &(*gourList)->rView );
- showRights( 0 );
- return;
- }
- break;
- case ITEM_CANCEL : /* hit the Cancel button */
- DisposDialog( da );
- return;
- break;
- }
- }
- }
-
- void afterdeleteSelectanother( short posorneg, Cell whatcell ){
-
- if( posorneg == 1 ){ // negative box is being worked on....
- LDelRow( 1, whatcell.v, gnegAcls );
- LSetSelect( true, whatcell, gnegAcls );
- if( LGetSelect( true, &whatcell, gnegAcls ) == false ) {
- whatcell.v--;
- LSetSelect( true, whatcell, gnegAcls );
- }
- showRights( whatcell.v );
- return;
- } else {
- LDelRow( 1, whatcell.v, gourList );
- LSetSelect( true, whatcell, gourList );
- if( LGetSelect( true, &whatcell, gourList ) == false ) {
- whatcell.v--;
- LSetSelect( true, whatcell, gourList );
- }
- showRights( whatcell.v );
- return;
- }
- }
-
-
-
- void deleteGroup( )
- {
- /* delete an acl... */
-
- short itemHit = 0, type, offset, focus;
- DialogPtr da;
- Handle groupname, okbutton;
- Rect numberbox;
- char nameofinterest[255];
- Cell whatcell = { 0, 0 };
-
- if ( gWindowstats.Focus == 2 ) {
- if ( LGetSelect( true, &whatcell, gnegAcls ) == false) return;
- focus = 1;
- } else if ( gWindowstats.Focus == 1 ) {
- if ( LGetSelect( true, &whatcell, gourList ) == false ) return;
- focus = 0;
- } else {
- // well, our focus must be on the drive/dir list so now we should figure out
- // which acl they are talking about...
- if ( LGetSelect( true, &whatcell, gourList ) == false ) {
- if( LGetSelect( true, &whatcell, gnegAcls ) == false ) return;
- focus = 1;
- } else focus = 0;
- }
-
- if (( da = GetNewDialog( DLOG_DEL, NULL, (WindowPtr)-1 )) == NULL ) {
- genericErrorstuff( -66666, kOff, 3 ); /* we should never be in here... */
- }
-
- SetPort( da );
- ShowWindow( da );
-
- GetDItem( da, ITEM_ADDGROUPEDIT, &type, &groupname, &numberbox );
- GetDItem( da, ITEM_OK, &type, &okbutton, &numberbox);
- if ( focus == 1 ) {
- if (whatcell.h < 0) whatcell.h = 0; /* and if I didn't click on anything, get from 0,0 */
- if (whatcell.v < 0) whatcell.v = 0;
- offset = 255;
- LGetCell( &nameofinterest+1, &offset, whatcell, gnegAcls );
- nameofinterest[0] = offset;
- nameofinterest[offset+1] = 0;
- SetIText( groupname, nameofinterest );
- } else {
- if (whatcell.h < 0) whatcell.h = 0; /* and if I didn't click on anything, get from 0,0 */
- if (whatcell.v < 0) whatcell.v = 0;
- offset = 255;
- LGetCell( &nameofinterest+1, &offset, whatcell, gourList );
- nameofinterest[0] = offset;
- nameofinterest[offset+1] = 0;
- SetIText( groupname, nameofinterest );
- }
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
-
- for (;;) {
- ModalDialog( nil, &itemHit );
- switch( itemHit ) {
- case ITEM_OK : /* hit the OK button */
- if ( focus == 1 ) afterdeleteSelectanother( 1, whatcell );
- else afterdeleteSelectanother( 0, whatcell );
- whatcell.h = 0;
- whatcell.v = 0;
- if( LGetSelect( true, &whatcell, dirList ) == false ){
- genericErrorstuff( 90000, kOn, 4 );
- }
- gAChange = whatcell.v+1; /* tell buildACL to change the acl.. */
- DisposDialog( da );
- SetPort( dp );
- return;
- break;
- case ITEM_CANCEL : /* hit the Cancel button */
- DisposDialog( da );
- SetPort( dp );
- return;
- break;
- }
- }
- }
-
- void resetPerm( short item, short whatrow, short value )
- {
- /* this function takes the value and pushes it into the acl-row */
-
- Cell cSize = { 0, 0 };
- Rect myRect;
- unsigned int j, bigSize, i;
- char objectName[256];
- unsigned char right, k;
- short objSize, permSize, type, focus;
- Handle generichandle;
-
- GetDItem( dp, item, &type, &generichandle, &myRect );
-
- if ( gWindowstats.Focus == 1 ) focus = 1;
- if ( gWindowstats.Focus == 2 ) focus = 2;
- if ( gWindowstats.Focus == 0 ) {
- if ( LGetSelect( true, &cSize, gourList ) == false ) {
- if ( LGetSelect( true, &cSize, gnegAcls ) == false ) return;
- focus = 2;
- } else focus = 1;
- }
-
- if ( focus == 2 ) {
-
- if( LGetSelect( true, &cSize, gnegAcls ) == false ) return;
-
- objSize = 255;
- cSize.h = 0;
- LGetCell(&objectName, &objSize, cSize, gnegAcls);
- if (objSize != 0)
- {
- /* Get the permission string. */
- cSize.h = 1;
- permSize = 1;
- LGetCell(&right, &permSize, cSize, gnegAcls);
- i = bigSize = right;
- if (bigSize < 0) { /* negative?? */
- sneakyNegative ( bigSize );
- }
- if ( i & value ) {
- bigSize = bigSize - value;
- SetCtlValue((ControlHandle)generichandle, 0 );
- } else {
- bigSize = bigSize + value;
- SetCtlValue((ControlHandle)generichandle, 1 );
- }
- j = 1;
- k = bigSize;
- LSetCell(&k, j, cSize, gnegAcls );
- gAChange = whatrow+1;
- return;
- } else genericErrorstuff( -66680, kOn, 5 ); /* we should never be in here... */
- } else {
-
- if( LGetSelect( true, &cSize, gourList ) == false ) return;
-
- objSize = 255;
- cSize.h = 0;
- LGetCell(&objectName, &objSize, cSize, gourList);
- if (objSize != 0)
- {
- /* Get the permission string. */
- cSize.h = 1;
- permSize = 1;
- LGetCell(&right, &permSize, cSize, gourList);
- i = bigSize = right;
- if (bigSize < 0) { /* negative?? */
- sneakyNegative ( bigSize );
- }
- if ( i & value ) {
- bigSize = bigSize - value;
- SetCtlValue((ControlHandle)generichandle, 0 );
- } else {
- bigSize = bigSize + value;
- SetCtlValue((ControlHandle)generichandle, 1 );
- }
- j = 1;
- k = bigSize;
- LSetCell(&k, j, cSize, gourList);
- gAChange = whatrow+1;
- return;
- } else genericErrorstuff( -66670, kOn, 6 ); /* we should never be in here... */
- }
- }
-
- void buildACL( )
- {
- Point theCell, where={0,0}, cSize;
- CInfoPBRec cInfoRec;
- HParamBlockRec paramBlock;
- char objectName[256], negobjectName[256], permStr[256],
- volumeName[255], listName[255],
- path[255], right;
- Handle data;
- short objSize, permSize, volumeid,
- dataLen = 255, pathLen = 255, honkyflag = 0;
- int posn;
- Byte count, negcount;
- long totSize, bigSize, negSize, MyCurDir;
- Handle cmd;
- XPPParamBlock xpp;
- Handle rights[9];
- Rect boxit;
- short boxthebutton, k = 1;
- char buffer[10], *ptr, up;
- long *did, error;
- short *vid;
- OSErr err;
- short xppRNum;
- Boolean done;
-
- if ( LGetSelect( true, &where, dirList) == false) {
- where.h=0;
- where.v=0;
- LSetSelect( true, where, dirList );
- }
-
- if ( gAChange > 0 ) where.v = gAChange-1;
-
- if (gTopLevel < 1) {
- /* if we're on the volume level */
- LGetCell( volumeName+1, &dataLen, where, dirList );
- LGetCell( listName+1, &pathLen, where, dirList );
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- where.h = 1;
- dataLen = 1;
- LGetCell( &up, &dataLen, where, dirList );
- paramBlock.fileParam.ioVRefNum = -up;
- paramBlock.volumeParam.ioVolIndex = 0;
- } else {
- /* if were down inside a volume */
- LGetCell( listName+1, &pathLen, where, dirList );
- where.h = 1;
- dataLen = 1;
- LGetCell( &up, &dataLen, where, dirList );
- paramBlock.fileParam.ioVRefNum = up;
- paramBlock.volumeParam.ioVolIndex = -1;
- where.h = 0;
- where.v = 1; /* this retrieves the volume name from our path list */
- dataLen = 255;
- LGetCell( volumeName+1, &dataLen, where, gpathList );
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- }
-
- paramBlock.fileParam.ioNamePtr = volumeName;
- paramBlock.fileParam.ioCompletion = 0;
-
- if ( err = (PBHGetVInfo( ¶mBlock, false )) != noErr ) {
- genericErrorstuff( err, kOff, 7 ); /* we should never be in here... */
- }
- if ( paramBlock.fileParam.ioResult != noErr ) genericErrorstuff( -66672, kOff, 8 ); /* we should never be in here... */
-
- volumeid = paramBlock.fileParam.ioVRefNum;
- if ( gTopLevel > 0 ) {
- path[0] = path[1] = 0;
- /* now piece together the path from our list */
- for ( count=1; count<=gTopLevel; count++ ) {
- SpinCursor( 12 );
- cSize.h = 0;
- cSize.v = count;
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, gpathList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- listName[0] = dataLen+1;
- strcat( path+1, listName+1 );
- }
- path[0] = strlen( path+1 );
- if (gAChange > 0) { /* this means we have one more name to add on... */
- SpinCursor( 12 );
- cSize.h = 0;
- cSize.v = gAChange - 1;
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, dirList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- listName[0] = dataLen+1;
- strcat( path+1, listName+1 );
- path[0] = strlen( path+1 );
- } else {
- cSize.h = 0;
- cSize.v = 0;
- if( LGetSelect( true, &cSize, dirList ) == false ){
- // we end up in here if there's nothing inside the parent directory
- LSetSelect( true, cSize, dirList );
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, gnegAcls );
- }
- if( cSize.v >= 0 ) {
- SpinCursor( 12 );
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, dirList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- listName[0] = dataLen+1;
- strcat( path+1, listName+1 );
- path[0] = strlen( path+1 );
- }
- }
-
- cInfoRec.dirInfo.ioNamePtr = path;
- cInfoRec.dirInfo.ioFDirIndex = 0;
- cInfoRec.dirInfo.ioVRefNum = volumeid;
- cInfoRec.hFileInfo.ioFVersNum = 0;
- cInfoRec.dirInfo.ioCompletion = 0;
- cInfoRec.hFileInfo.ioDirID = 0;
- if ( error = (PBGetCatInfo( &cInfoRec, false ) != noErr )) {
- if( error != 1 ) { /* this kludge gets us out of bad bad netatalk returns */
- genericErrorstuff( -66675, kOff, 9 ); /* we should never be in here... */
- }
- }
- if ( cInfoRec.dirInfo.ioResult != noErr ) {
- if( error != 1 ) { /* this kludge gets us out of bad bad netatalk returns */
- genericErrorstuff( -66676, kOff, 10); /* we should never be in here... */
- }
- }
- } else strcpy( path,volumeName );
- if ( gTopLevel == 0 ) {
- MyCurDir = 2L; /* root directory of a vol is 2 */
- } else MyCurDir = cInfoRec.hFileInfo.ioDirID;
-
- /* here's my attempt to get the vcb */
- vcb = (AVCB*)0x0358;
- done = false;
- while ((vcb != 0L) && !done)
- {
- SpinCursor( 12 );
- if (vcb->vcbVRefNum == volumeid)
- {
- if (vcb->vcbFSID != 0)
- done = true;
- else
- vcb = (AVCB*)vcb->qLink;
- }
- else
- vcb = (AVCB*)vcb->qLink;
- }
-
- cInfoRec.dirInfo.ioNamePtr = path;
- cInfoRec.dirInfo.ioVRefNum = volumeid;
- cInfoRec.dirInfo.ioFDirIndex = -1;
- cInfoRec.dirInfo.ioDrDirID = MyCurDir;
-
- PBGetCatInfo(&cInfoRec,false);
- /* end lousy attempt to get vcb */
-
- totSize = 1;
- data = NewHandle(totSize);
- HLock(data);
- totSize = 0; // mike wisely enhanced this....
- HUnlock(data);
- theCell.v = 0;
- count = 0;
- negcount = 0;
-
- bzero( buffer, 10L);
- bzero( (char *)&xpp, sizeof(XPPParamBlock));
- if ( OpenXPP( &xppRNum ) != noErr ) {
- DebugStr("\p hey dude");
- }
- do
- {
- SpinCursor( 12 );
- objSize = 255;
- theCell.h = 0;
- LGetCell(&objectName, &objSize, theCell, gourList);
- if (objSize != 0)
- {
- /* Get the permission string. */
- theCell.h = 1;
- permSize = 1;
- LGetCell(&right, &permSize, theCell, gourList);
- bigSize = right;
- if (bigSize < 0)
- bigSize = -bigSize + 128;
- NumToString(bigSize, &permStr);
- permSize = permStr[0];
- count++;
- posn = totSize;
- totSize = totSize + objSize + permSize + 2;
- SetHandleSize(data, totSize); /* a space and then the byte */
- HLock(data);
- if ( count > 1 ) {
- *((*data)+posn) = '\r';
- posn++;
- } else totSize--;
- SpinCursor( 12 );
- bigSize = objSize;
- BlockMove(objectName, (*data)+posn, bigSize);
- posn += objSize;
- *((*data)+posn) = ' ';
- posn++;
- bigSize = permSize;
- BlockMove(&(permStr[1]), (*data)+posn, bigSize);
- HUnlock(data);
- }
- } while ( LNextCell(false,true, &theCell, gourList ));
-
- theCell.v = 0;
- theCell.h = 0;
-
- if ( LNextCell( true, true, &theCell, gnegAcls )){
- do
- {
- SpinCursor( 12 );
- objSize = 255;
- theCell.h = 0;
- LGetCell(&objectName, &objSize, theCell, gnegAcls);
- if (objSize != 0)
- {
- /* Get the permission string. */
- theCell.h = 1;
- permSize = 1;
- LGetCell(&right, &permSize, theCell, gnegAcls);
- bigSize = right;
- /* I MAY WANT TO CHANGE THE BELOW... */
-
- if (bigSize < 0)
- bigSize = -bigSize + 128;
- NumToString(bigSize, &permStr);
- permSize = permStr[0];
- negcount++;
- posn = totSize;
- totSize = totSize + objSize + permSize + 2;
- SetHandleSize(data, totSize); /* a space and then the byte */
- HLock(data);
- *((*data)+posn) = '\r';
- posn++;
- bigSize = objSize;
- BlockMove(objectName, (*data)+posn, bigSize);
- posn += objSize;
- *((*data)+posn) = ' ';
- posn++;
- bigSize = permSize;
- BlockMove(&(permStr[1]), (*data)+posn, bigSize);
- HUnlock(data);
- }
- } while ( LNextCell(false,true, &theCell, gnegAcls ));
- }
-
- /* Write the number of positive acls. */
- bigSize = count;
- NumToString(bigSize, &objectName);
- bigSize = objectName[0];
-
- negSize = negcount;
- NumToString(negSize, &negobjectName);
- negSize = negobjectName[0];
-
- totSize += bigSize + 1 + negSize + 1 + 2;
- SetHandleSize(data, totSize);
- SpinCursor( 12 );
- HLock(data);
-
- BlockMove(*data , (*data) + bigSize + 1 + negSize + 1, totSize - bigSize - negSize - 2);
- *((*data)+0) = 'X';
- *((*data)+1) = 'X';
- *((*data)+2) = 'X';
- *((*data)+3) = 'X';
-
- BlockMove(&(objectName[1]), *data, bigSize);
- *((*data)+bigSize) = '\r';
- BlockMove(&(negobjectName[1]), ((*data)+bigSize+1), negSize );
- *((*data)+bigSize+1+negSize) = '\r';
- *((*data)+totSize - 2) = '\r';
- *((*data)+totSize - 1) = '\0';
-
- /* Build up the command request string */
- cmd = NewHandle(10L);
- HLock(cmd);
- ptr = *(char**)cmd;
- ptr[0] = 101;
- ptr[1] = 0;
- vid = (short*)&ptr[2];
- did = (long*)&ptr[4];
-
- *did = MyCurDir;
- *vid = (short)vcb->vcbServerVol;
- ptr[8] = 2;
- ptr[9] = 0;
- HUnlock(cmd);
- HLock(data);
- HandAndHand(data, cmd);
- DisposHandle(data);
- HLock(cmd);
-
- // Gee, you don't even rate a cube huh? // Dave
- /* Set up the AFP call, and send it off to WES */
- /* Look at setting timeouts better */
- xpp.XPP.sessRefnum = vcb->vcbSRefNum;
- xpp.XPP.ioRefNum = xppRNum;
- xpp.XPP.ioCompletion = 0L;
- xpp.XPP.csCode = 250;
- xpp.XPP.aspTimeout = 2;
- xpp.XPP.cbSize = GetHandleSize(cmd);
- xpp.XPP.cbPtr = *cmd;
- xpp.LOGIN.rbSize = 10;
- xpp.LOGIN.rbPtr = buffer;
- err = AFPCommand(&xpp, false);
-
- /* okay.. here lets highlight the controls accordingly... */
-
- for ( count=0; count<7; count++) {
- GetDItem( dp, RIGHTS+count, &boxthebutton, &rights[count], &boxit );
- }
- SpinCursor( 12 );
- GetDItem( dp, ADDBUTTON, &boxthebutton, &rights[7], &boxit );
- GetDItem( dp, REMBUTTON, &boxthebutton, &rights[8], &boxit );
-
- if (err) {
- if ( err != -1070 ) { /* THIS IS VERY RISKY..... */
- genericErrorstuff( err, kOff, 11 );
- }
-
- /* add this in later.... alert(AFPERROR) */
- }
- if (xpp.XPP.cmdResult != noErr ) {
- for( count=0; count<9; count++) {
- HiliteControl(( ControlHandle )rights[count], 255);
- }
- SetItem( gOptions, kSettings, "\pCan't Set Access Settings" );
- DisableItem( gOptions, kSettings );
- gWindowstats.Permit = 0; // no permission....
- DisposHandle(cmd);
- return;
- }
- for( count=0; count<9; count++) {
- HiliteControl(( ControlHandle )rights[count], 0);
- SetItem( gOptions, kSettings, "\pAccess Settings" );
- EnableItem( gOptions, kSettings );
- gWindowstats.Permit = 1; // you can permit things here....
- }
- DisposHandle(cmd);
- }
-
- void PlotSICN(Rect *theRect, SICNHand theSICN, long theIndex) {
- auto char state; /*saves original flags of 'SICN' handle*/
- auto BitMap srcBits; /*built up around 'SICN' data so we can _CopyBits*/
-
- if(( GetHandleSize((Handle)theSICN ) / sizeof(SICN )) > theIndex ) {
- /* store the resource's current locked/unlocked condition */
- state = HGetState((Handle)theSICN);
-
- /* lock the resource so it won't move during the _CopyBits call */
- HLock((Handle)theSICN);
-
- /* set up the small icon's bitmap */
- srcBits.baseAddr = (Ptr) (*theSICN)[theIndex];
- srcBits.rowBytes = 2;
- SetRect(&srcBits.bounds, 0, 0, 16, 16);
-
- /* draw the small icon in the current grafport */
- CopyBits(&srcBits,&(*qd.thePort).portBits,&srcBits.bounds, theRect,srcCopy,nil);
-
- /* restore the resource's locked/unlocked condition */
- HSetState((Handle) theSICN, state);
- }
- }
-
- void swapFocus( short wheretogo )
- { /* simply swaps the focus between left and right.... */
- Cell celljack = { 0, 0 };
- Rect firstbox, secondbox, thirdbox;
-
- firstbox = (*dirList)->rView;
- secondbox = (*gourList)->rView;
- thirdbox = ( *gnegAcls )->rView;
- thirdbox.right = thirdbox.right+15;
- secondbox.right = secondbox.right+15;
- firstbox.right = firstbox.right+15;
- InsetRect( &thirdbox, -4, -4 );
- InsetRect( &firstbox, -4, -4);
- InsetRect( &secondbox, -4, -4); /* was 5 5 */
-
- PenSize(2,2);
- ForeColor( whiteColor );
-
- if ( gWindowstats.Focus == 2 ){
- if ( wheretogo == 1 ){
- // switching from negative acl box to positive acl box...
- // first thing we do is deselect whatever was in the negative acl box
- if ( LGetSelect( true, &celljack, gnegAcls ) == true ) LSetSelect( false, celljack, gnegAcls );
- FrameRect( &thirdbox );
- ForeColor( blackColor );
- FrameRect( &secondbox );
-
- // and then select the first thing that is in the positive list....
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gourList ) == false ) LSetSelect( true, celljack, gourList );
- showRights( celljack.v );
- gWindowstats.Focus = 1;
- PenSize( 1, 1 );
- return;
- } else {
- // well we must have clicked on the drive box, then...
- FrameRect( &thirdbox );
- ForeColor( blackColor );
- FrameRect( &firstbox );
- gWindowstats.Focus = 0;
- PenSize( 1, 1 );
- return;
- }
- }
- if ( gWindowstats.Focus == 1 ) {
- FrameRect( &secondbox );
- ForeColor( blackColor );
- if ( wheretogo == 2 ) {
- // switching from positive acl box to negative box....
- FrameRect( &thirdbox );
- gWindowstats.Focus = 2;
- if ( LGetSelect( true, &celljack, gourList ) == true ) LSetSelect( false, celljack, gourList );
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gnegAcls ) == false ) LSetSelect( true, celljack, gnegAcls );
- showRights( celljack.v );
- } else {
- // no negative acl state so just swap to drive box....
- FrameRect( &firstbox );
- gWindowstats.Focus = 0;
- }
- PenSize( 1, 1 );
- return;
- } else if ( gWindowstats.Focus == 0 ){
- FrameRect( &firstbox );
- ForeColor( blackColor );
- if (( wheretogo == 2 ) && ( gWindowstats.State == 1 )) {
- // going from drive list to negative acl box....
- // deselect whatever's in the positive acl box...
- FrameRect( &thirdbox );
- gWindowstats.Focus = 2;
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gourList ) == true ){
- LSetSelect( false, celljack, gourList );
- };
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gnegAcls ) == false ){
- LSetSelect( true, celljack, gnegAcls );
- }
- } else {
- FrameRect( &secondbox );
- gWindowstats.Focus = 1;
- if ( gWindowstats.State == 1 ) {
- // switching from drive list to positive acl box...
- // deselect whatever's in the negative acl box
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gnegAcls ) == true ){
- LSetSelect( false, celljack, gnegAcls );
- };
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gourList ) == false ){
- LSetSelect( true, celljack, gourList );
- }
- }
- }
- showRights( celljack.v );
- }
- PenSize(1,1);
- }
-
- void rswapFocus( void )
- { /* simply swaps the focus between left and right.... */
- Cell celljack = { 0, 0 };
- Rect firstbox, secondbox, thirdbox;
-
- firstbox = (*dirList)->rView;
- secondbox = (*gourList)->rView;
- thirdbox = ( *gnegAcls )->rView;
- thirdbox.right = thirdbox.right+15;
- secondbox.right = secondbox.right+15;
- firstbox.right = firstbox.right+15;
- InsetRect( &thirdbox, -4, -4 );
- InsetRect( &firstbox, -4, -4);
- InsetRect( &secondbox, -4, -4); /* was 5 5 */
-
- PenSize( 2, 2 );
- ForeColor( whiteColor );
- if (( gWindowstats.Focus == 2 ) && ( gWindowstats.State == 1 )){
- // currently in negative ACL box, going to positive ACL box....
- FrameRect( &thirdbox );
- ForeColor( blackColor );
- FrameRect( &secondbox );
- if ( LGetSelect( true, &celljack, gnegAcls ) == true ) {
- LSetSelect( false, celljack, gnegAcls );
- LDraw( celljack, gnegAcls );
- }
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gourList ) == false ){
- LSetSelect( true, celljack, gourList );
- }
- gWindowstats.Focus = 1;
- showRights( celljack.v );
- PenSize( 1, 1 );
- return;
- } else if ( gWindowstats.Focus == 1 ) {
- // going from positive acl box to drive list....
- FrameRect( &secondbox );
- ForeColor( blackColor );
- FrameRect( &firstbox );
- gWindowstats.Focus = 0;
- PenSize( 1, 1 );
- return;
- } else if ( gWindowstats.Focus == 0 ) {
- // go from drive box to negative acl box, if it exists...
- FrameRect( &firstbox );
- ForeColor( blackColor );
- if ( gWindowstats.State == 1 ) {
- FrameRect( &thirdbox );
- // switching from drive list to positive acl box...
- // deselect whatever's in the negative acl box
- if( LGetSelect( true, &celljack, gourList ) == true ){
- LSetSelect( false, celljack, gourList );
- LDraw( celljack, gourList );
- };
- celljack.h = 0;
- celljack.v = 0;
- if( LGetSelect( true, &celljack, gnegAcls ) == false ){
- LSetSelect( true, celljack, gnegAcls );
- }
- gWindowstats.Focus = 2;
- showRights( celljack.v );
- } else {
- FrameRect( &secondbox );
- gWindowstats.Focus = 1;
- }
- }
- PenSize(1,1);
- }
-
- void downFocus( void )
- {
- Cell place = {0, 0}, oldplace;
-
- if ( gWindowstats.Focus == 2 ) {
- // the action is happening in the negative acl List....
- if (LGetSelect( true, &place, gnegAcls ) == false) {
- showRights( 0 );
- return; /* there is nothing in the negative acl list so return */
- }
- oldplace = place;
- if ( LNextCell( false, true, &place, gnegAcls ) == true) {
- LSetSelect( false, oldplace, gnegAcls );
- LSetSelect( true, place, gnegAcls );
- LAutoScroll( gnegAcls );
- }
- negSelect( 0 );
- return;
- }
-
- if ( gWindowstats.Focus == 0 ) { /* is the action happening in the drive list? */
- if (LGetSelect( true, &place, dirList ) == false) {
- genericErrorstuff( -66666, kOn, 12 ); /* we should never be in here... */
- }
- oldplace = place;
- if ( LNextCell( false, true, &place, dirList ) == true) {
- LSetSelect( false, oldplace, dirList );
- LSetSelect( true, place, dirList );
- LAutoScroll( dirList );
- }
- dirSelect( 0 );
- Show_Cursor( ARROW_CURSOR );
- } else {
- if (LGetSelect( true, &place, gourList ) == false) {
- showRights( 0 );
- return; /* there is nothing in the negative acl list so return */
- }
- oldplace = place;
- if ( LNextCell( false, true, &place, gourList ) == true) {
- LSetSelect( false, oldplace, gourList );
- LSetSelect( true, place, gourList );
- LAutoScroll( gourList );
- }
- aclSelect( 0 );
- }
- }
-
- void upFocus( void )
- {
- Cell place = {0, 0}, oldplace;
-
- if ( gWindowstats.Focus == 2 ) {
- if (LGetSelect( true, &place, gnegAcls ) == false) {
- showRights( 0 );
- return; /* there is nothing in the negative acl list so return */
- }
- oldplace = place;
- place.v--;
- if ( place.v >= 0 ) {
- LSetSelect( false, oldplace, gnegAcls );
- LSetSelect( true, place, gnegAcls );
- LAutoScroll( gnegAcls );
- }
- negSelect( 0 );
- }
-
- if ( gWindowstats.Focus == 0 ) { /* is the action happening in the drive list? */
- if (LGetSelect( true, &place, dirList ) == false) {
- showRights( 0 );
- return; /* there is nothing in the negative acl list so return */
- }
- oldplace = place;
- place.v--;
- if ( place.v >= 0 ) {
- LSetSelect( false, oldplace, dirList );
- LSetSelect( true, place, dirList );
- LAutoScroll( dirList );
- }
- dirSelect( 0 );
- Show_Cursor( ARROW_CURSOR );
- } else {
- if (LGetSelect( true, &place, gourList ) == false) {
- showRights( 0 );
- return; /* there is nothing in the negative acl list so return */
- }
- oldplace = place;
- place.v--;
- if ( place.v >= 0 ) {
- LSetSelect( false, oldplace, gourList );
- LSetSelect( true, place, gourList );
- LAutoScroll( gourList );
- }
- aclSelect( 0 );
- }
- }
-
- void replotItall( void )
- {
-
- Rect myRect = { 0, 0, 0, 0 }, removebox, boxit, nutthinbox,
- addbox,
- oldRect, newRect, boogieRect;
- Handle removehandle, addhandle, buttonHandle[7], nothingspecial;
- Point inbetween, cellsz;
- float heightchange, widthchange, olddialogheight, olddialogwidth,
- newdialogheight, newdialogwidth;
- short addshort, removeshort, boxthebutton, btype;
- int workonleft, workontop;
-
- LDoDraw( false, gourList );
- LDoDraw( false, dirList );
-
- SetPort( dp );
- newRect = dp->portRect; /* the NEW rectangle... */
- EraseRect( &dp->portRect ); /* I don't want to see this shit goin' down.... */
- ClipRect( &myRect );
-
- /* this code figures out the percentage change in our rectangle size */
-
- oldRect = gsizeDialrect;
-
- olddialogheight = ( oldRect.bottom - oldRect.top );
- olddialogwidth = ( oldRect.right - oldRect.left );
- newdialogheight = ( newRect.bottom - newRect.top );
- newdialogwidth = ( newRect.right - newRect.left );
-
- heightchange=( newdialogheight / olddialogheight );
- widthchange=( newdialogwidth / olddialogwidth );
-
- myRect = (*dirList)->rView;
- inbetween.h = myRect.right;
- inbetween.v = myRect.bottom;
-
- myRect.right = (myRect.right * widthchange);
- myRect.bottom = ( newRect.bottom - 6 );
- myRect.top = 27;
- myRect.left = 9;
- HideControl(( *dirList)->vScroll );
- cellsz.h = myRect.right-myRect.left+5;
- cellsz.v = (*dirList)->cellSize.v;
- LCellSize( cellsz, dirList );
- LSize(( myRect.right-myRect.left ), ( myRect.bottom - myRect.top ), dirList);
- (*dirList)->rView.right = myRect.right+1;
- (*dirList)->rView.top = myRect.top;
- (*dirList)->rView.bottom = myRect.bottom;
- (*dirList)->rView.left = myRect.left;
-
- MoveControl(( *dirList)->vScroll, myRect.right+2, myRect.top-1 );
- SizeControl(( *dirList)->vScroll, 15, ( myRect.bottom - myRect.top+2 ));
- myRect.right=myRect.right+15;
- GetDItem( dp, ITEM_FIRSTBOX, &boxthebutton, ¬hingspecial, &nutthinbox );
- SetDItem( dp, ITEM_FIRSTBOX, boxthebutton, (Handle)firstBox, &myRect );
-
- myRect.left = ( myRect.right + 24 - 15 );
- myRect.right = ( newRect.right - 101 );
- myRect.bottom = ( newRect.bottom - 40 );
- myRect.top = 25;
-
- if ( gWindowstats.State == 1 ) myRect.bottom = ( myRect.bottom / 2 );
-
- boogieRect = (*gourList)->rView;
- inbetween.h = boogieRect.right;
- HideControl(( *gourList)->vScroll );
- cellsz.h = myRect.right-myRect.left+5;
- cellsz.v = (*gourList)->cellSize.v;
- LCellSize( cellsz, gourList );
- LSize(( myRect.right-myRect.left ), ( myRect.bottom - myRect.top ), gourList);
-
- (*gourList)->rView.right = myRect.right+1;
- (*gourList)->rView.top = myRect.top;
- (*gourList)->rView.bottom = myRect.bottom;
- (*gourList)->rView.left = myRect.left;
-
- MoveControl(( *gourList)->vScroll, myRect.right+2, myRect.top-1 );
- SizeControl(( *gourList)->vScroll, 15, ( myRect.bottom - myRect.top+2 ));
- myRect.right=myRect.right+15;
-
- GetDItem( dp, ITEM_SECONDBOX, &boxthebutton, ¬hingspecial, &nutthinbox );
- SetDItem( dp, ITEM_SECONDBOX, boxthebutton, (Handle)secondBox, &myRect );
-
- /* if the Negative ACL box is being displayed, then move the box around */
- if ( gWindowstats.State == 1 ) {
- myRect.top = myRect.bottom+30;
- myRect.right=myRect.right-15;
- myRect.bottom = ( dp->portRect.bottom-38 );
-
- boogieRect = (*gnegAcls)->rView;
- inbetween.h = boogieRect.right;
- HideControl(( *gnegAcls)->vScroll );
- cellsz.h = myRect.right-myRect.left;
- cellsz.v = (*gnegAcls)->cellSize.v;
- LCellSize( cellsz, gnegAcls );
- LSize(( myRect.right-myRect.left ), ( myRect.bottom - myRect.top ), gnegAcls);
-
- (*gnegAcls)->rView.right = myRect.right+1;
- (*gnegAcls)->rView.top = myRect.top;
- (*gnegAcls)->rView.bottom = myRect.bottom;
- (*gnegAcls)->rView.left = myRect.left;
-
- MoveControl(( *gnegAcls)->vScroll, myRect.right+2, myRect.top-1 );
- SizeControl(( *gnegAcls)->vScroll, 15, ( myRect.bottom - myRect.top+2 ));
- myRect.right=myRect.right+15;
- GetDItem( dp, ITEM_NEGBOX, &boxthebutton, ¬hingspecial, &nutthinbox );
- SetDItem( dp, ITEM_NEGBOX, boxthebutton, (Handle)bonusBox, &myRect );
- }
-
- // this bit of code moves the "positive" title
- GetDItem( dp, ITEM_POSITIVE, &boxthebutton, ¬hingspecial, &boxit );
- boxit.left = myRect.left;
- boxit.top = 2;
- boxit.bottom = 20;
- boxit.right = myRect.left + 110;
- SetDItem( dp, ITEM_POSITIVE, boxthebutton, (Handle)posornegBox, &boxit );
-
- inbetween.h = newRect.right;
- inbetween.v = newRect.bottom;
-
- GetDItem( dp, 10, &addshort, &addhandle, &addbox );
- workonleft = ( inbetween.h - 239 );
- workontop = ( inbetween.v - 30 );
-
- addbox.left = workonleft;
- addbox.top = workontop;
- addbox.right = workonleft+105;
- addbox.bottom = workontop+20;
-
- SetDItem( dp, 10, addshort, addhandle, &addbox );
- MoveControl((ControlHandle)addhandle, workonleft, workontop );
-
- GetDItem( dp, 11, &removeshort, &removehandle, &removebox );
- workonleft = ( inbetween.h - 125 );
-
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+105;
- removebox.bottom = workontop+20;
-
- SetDItem( dp, 11, removeshort, removehandle, &removebox );
- MoveControl((ControlHandle)removehandle, workonleft, workontop );
-
- // move READ
- GetDItem( dp, 3, &btype, &buttonHandle[0], &removebox );
- workonleft = ( newRect.right - 79 );
- workontop = 9;
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 3, btype, buttonHandle[0], &removebox );
- MoveControl((ControlHandle)buttonHandle[0], workonleft, workontop );
-
- // move WRITE
- GetDItem( dp, 4, &btype, &buttonHandle[1], &removebox );
- workontop = 26;
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 4, btype, buttonHandle[1], &removebox );
- MoveControl((ControlHandle)buttonHandle[1], workonleft, workontop );
-
- // move INSERT
- GetDItem( dp, 5, &btype, &buttonHandle[2], &removebox );
- workontop = 43;
- MoveControl((ControlHandle)buttonHandle[2], workonleft, workontop );
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 5, btype, buttonHandle[2], &removebox );
-
- // move LOOKUP
- GetDItem( dp, 6, &btype, &buttonHandle[3], &removebox );
- workontop = 77;
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 6, btype, buttonHandle[3], &removebox );
- MoveControl((ControlHandle)buttonHandle[3], workonleft, workontop );
-
- // move DELETE
- GetDItem( dp, 7, &btype, &buttonHandle[4], &removebox );
- workontop = 60;
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 7, btype, buttonHandle[4], &removebox );
- MoveControl((ControlHandle)buttonHandle[4], workonleft, workontop );
-
- // move LOCK
- GetDItem( dp, 8, &btype, &buttonHandle[5], &removebox );
- workontop = 94;
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 8, btype, buttonHandle[5], &removebox );
- MoveControl((ControlHandle)buttonHandle[5], workonleft, workontop );
-
- // move PERMIT
- GetDItem( dp, 9, &btype, &buttonHandle[6], &removebox );
- workontop = 111;
- MoveControl((ControlHandle)buttonHandle[6], workonleft, workontop );
- removebox.left = workonleft;
- removebox.top = workontop;
- removebox.right = workonleft+106;
- removebox.bottom = workontop+18;
- SetDItem( dp, 9, btype, buttonHandle[6], &removebox );
-
- LDoDraw( true, gourList );
- LDoDraw( true, dirList );
- if ( gWindowstats.State == 1 ) {
- LDoDraw( true, gnegAcls );
- }
-
- ClipRect( &dp->portRect );
- InvalRect( &dp->portRect );
-
- gsizeDialrect = dp->portRect; /* set gsizeDialrect to our new-sized dialog box */
-
- }
-
- short getAFSvol( short whichVol ){
-
- HParamBlockRec audioCheck;
- OSErr whaterror;
- char volName[255];
- short volRefNum;
-
- /* return positive number if we're out of volumes to count, as all *
- * mounted volumes have negative vrefnumbers */
-
- if (GetIndVolume( whichVol, volName, &volRefNum) == nsvErr) return 1;
-
- vcb = (AVCB *)(getVCBbyrefnum( volRefNum ));
- SpinCursor( 8 );
- if (isafsVCB( vcb ) == true) {
- bzero(( char *)&audioCheck, sizeof( HParamBlockRec ));
- audioCheck.fileParam.ioCompletion = nil;
- audioCheck.fileParam.ioNamePtr = volName;
- audioCheck.fileParam.ioVRefNum = volRefNum;
- if( whaterror = PBHGetVInfo( &audioCheck, false ) != noErr ){
- genericErrorstuff((long)whaterror, kOn, 19 );
- }
- if (!( audioCheck.volumeParam.ioVFSID & 0x4A48 )){
- if (getdirAcl( volRefNum, OBNOXIOUSHIGHNUMBER ) == true) {
- return volRefNum;
- }
- }
- }
- return 0;
- }
-
- void waiting( void ){
-
- DialogPtr origPort, duhPort;
- Rect popupRect = RECT_POPUPMENU;
- short returnednum, makelistflag, whichVol, oldvolcount, volcount, lo, duh;
- signed short mountedafsvols[256];
-
- LActivate( false, dirList );
- LActivate( false, gourList );
- LActivate( false, gnegAcls );
-
- volcount = 0;
- for( whichVol=1;;whichVol++ ){
- if(( returnednum = getAFSvol( whichVol )) > 0 ) break;
- else if( returnednum < 0 ){
- mountedafsvols[volcount++] = returnednum;
- }
- }
-
- mountedafsvols[volcount] = 0;
-
- for (;;) {
- if ( WaitNextEvent( updateMask+osMask, &er, 13, NIL )) {
- if ( er.what == osEvt ){
- lo = (char) (( er.message & 0xff000000) >> 24);;
- if( lo == suspendResumeMessage ){
- if( er.message & resumeFlag ){
- Show_Cursor((Cursors) ACUR_SPIN);
-
- /* go through our mounted AFS volume array that we created *
- * above and make sure that we have the same volumes on *
- * the desktop. If not, turn a flag on and build the *
- * volume list again */
-
- oldvolcount = volcount;
- volcount = 0;
- makelistflag = 0;
- for( whichVol=1;;whichVol++ ){
- if(( returnednum = getAFSvol( whichVol )) > 0 ) break;
- else if ( returnednum < 0 ){
- if( returnednum != mountedafsvols[volcount++] )
- makelistflag = 1;
- }
- }
-
- if( volcount != oldvolcount ) makelistflag = 1;
-
- LActivate( true, dirList );
- LActivate( true, gourList );
- LActivate( true, gnegAcls );
- if( makelistflag == 1 ) {
- gotoToplevel( );
- EraseRect( &popupRect );
- InvalRect( &popupRect );
- }
- Show_Cursor( ARROW_CURSOR );
- return;
- }
- }
- } else {
- GetPort( &origPort );
- SetPort( dp );
- DialogSelect( &er, &duhPort, &duh );
- SetPort( origPort );
- }
- }
- }
- }
-
- void eventLoop ()
- {
- DialogPtr duhport;
- Rect sizeRect = { 170, 425, 3000, 3000 }, boundsRect = { 0, 0, 4096, 4096 }, myRect;
- Point startPt;
- WindowPtr whichWindow;
- long whichMenuItem, returnedCharacter, newSize;
- short whereWindow, lo, hi, limit;
-
- for (;;) {
- if ( WaitNextEvent( everyEvent, &er, 1, NIL )) {
- /* this handles it when somebody mounts a volume or disk */
-
- if ( er.what == diskEvt ){
- gotoToplevel( );
- }
-
- if ( er.what == osEvt ){
- lo = (char) (( er.message & 0xff000000) >> 24);;
- if( lo == suspendResumeMessage ){
- if (!( er.message & resumeFlag )) waiting( );
- }
- }
-
- if( gWindowstats.State == 0 ) limit = 1;
- else limit = 2;
- // first thing we look for, is key events.....
- if ( er.what == keyDown ) { /* any key is being pressed */
- if ( er.modifiers & cmdKey ) { /* it is a cmd key function */
- whichMenuItem = MenuKey( er.message & charCodeMask );
- doMenu( whichMenuItem );
- } if ( er.modifiers & shiftKey ){ /* holding the SHIfT key down... */
- returnedCharacter = ( BitAnd( er.message, keyCodeMask ));
- lo = ( returnedCharacter & 0xffff) ;
- if ( lo == kTABKEY ) rswapFocus( );
- } else { /* More key events here XXX */
- returnedCharacter = ( BitAnd( er.message, keyCodeMask ));
- lo = ( returnedCharacter & 0xffff) ;
- if ( lo == kTABKEY ){
- if (gWindowstats.Focus+1 > limit) swapFocus( 0 );
- else swapFocus( gWindowstats.Focus+1 );
- }
- else if ( lo == kDOWNKEY ) downFocus( );
- else if ( lo == kUPKEY ) upFocus( );
- }
- } else {
- /* insert dialog keyboard events here.... */
-
- if ( IsDialogEvent( &er )) {
- if ( DialogSelect( &er, &duhport, &gItem )) {
- doDialog( gItem );
- }
- } else {
- /* is the mouse doing something in the menu? */
- if ( er.what == mouseDown ) {
- whereWindow = FindWindow( er.where, &whichWindow );
- switch( whereWindow ) {
- case inMenuBar : /* in menu bar */
- whichMenuItem = MenuSelect( er.where );
- doMenu( whichMenuItem ) ;
- break ;
-
- case inDrag : /* in drag/title bar... */
- startPt = er.where ;
- DragWindow (whichWindow, startPt, &boundsRect) ;
- break;
-
- case inGrow : /* in the grow box... */
- if (whichWindow == dp ) {
- myRect = dp->portRect;
- startPt = er.where ;
- newSize = GrowWindow( dp, startPt, &sizeRect);
- if ( newSize != 0 ) {
- hi = ((newSize) >> 16) ;
- lo = (newSize) ;
- InvalRect( &myRect );
- SizeWindow( dp, lo, hi, true );
- replotItall( );
- }
- break;
- }
-
- case inZoomIn: case inZoomOut: /* in ZOOM box */
- whereWindow = ( FindWindow (er.where, &dp ));
- if (TrackBox( whichWindow, er.where, whereWindow )) {
- if ((whereWindow == inZoomOut) || (whereWindow == inZoomIn)) {
- SetPort( dp );
- myRect = dp->portRect;
- gWindowsize.userState = myRect;
- InvalRect( &myRect );
- EraseRect( &myRect );
- ZoomWindow( dp, whereWindow, true);
- }
- myRect = dp->portRect;
- ValidRect( &myRect );
- replotItall( );
- EndUpdate( dp );
- break;
- }
- break;
-
- case inGoAway : /* in go-away box... */
- if ( TrackGoAway( whichWindow, er.where ) == true) {
- if ( whichWindow == dp ) {
- shouldireallyquit( );
- CloseDialog ( dp ) ;
- termiNate ( ) ;
- break;
- }
- } /* end shall I go away ? */
- break;
-
- case inContent : /* in content region */
- if (whichWindow == dp) {
- SelectWindow( dp );
- SetPort( dp );
- }
- break;
- }
- }
- }
- }
- }
- }
- }
-
- short buildLoop ()
- {
- long returnedCharacter;
- short lo;
-
- for (;;) {
- if ( WaitNextEvent( keyDownMask, &er, 1, NIL )) {
- // only thing we look for, is key events.....
- if ( er.what == keyDown ) { /* any key is being pressed */
- if ( er.modifiers & cmdKey ){ /* holding the COMMAND key down... */
- returnedCharacter = ( BitAnd( er.message, keyCodeMask ));
- lo = ( returnedCharacter & 0xffff) ;
- if ( lo == kPeriod ) return 1;
- } else { /* More key events here XXX */
- returnedCharacter = ( BitAnd( er.message, keyCodeMask ));
- lo = ( returnedCharacter & 0xffff) ;
- if ( lo == kEscape ) return 1;
- }
- }
- }
- return 0;
- }
- }
-
- void godownintoDirectory( void )
- {
-
- Cell cSize, where;
- OSErr error;
- HParamBlockRec paramBlock;
- Rect badRect= RECT_POPUPMENU;
- char listName[255], path[255], volumeName[255], down;
- long directoryid = 0, volumeid;
- short theRow, off, count, dataLen, pathLen, offset;
-
- /* user has clicked twice on a directory entry...
- so let's go INSIDE the directory */
-
- Show_Cursor((Cursors) ACUR_SPIN);
- if ( gAChange > 0) {
- buildACL( );
- gAChange = 0;
- }
-
- SpinCursor( 8 );
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, gnegAcls );
- LDoDraw( false, gourList );
- LDoDraw( false, gnegAcls );
-
- /* initialize the path */
- for( count=0; count<256; count++ ) {
- path[count] = 0;
- }
- dataLen = 255;
- pathLen = 255;
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- SpinCursor( 12 );
- gTopLevel++ ; /* we're going down.. so we ain't on the top level */
- bzero((char *)¶mBlock, sizeof( HParamBlockRec ));
- if (gTopLevel == 1) { /* if we're on the volume level */
- LGetCell( volumeName+1, &dataLen, where, dirList );
- LGetCell( listName+1, &pathLen, where, dirList );
- } else {
- LGetCell( listName+1, &pathLen, where, dirList );
- where.v = 1; /* this retrieves the volume name from our path list */
- LGetCell( volumeName+1, &dataLen, where, gpathList );
- }
-
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- dataLen = 1;
- where.h = 1;
- LGetCell( &down, &dataLen, where, dirList );
- paramBlock.fileParam.ioVRefNum = down;
- listName[0] = pathLen;
- paramBlock.fileParam.ioNamePtr = volumeName;
- paramBlock.fileParam.ioCompletion = 0;
- paramBlock.volumeParam.ioVolIndex = -1;
- SpinCursor( 12 );
-
- if ( error = PBHGetVInfo( ¶mBlock, false ) != noErr ) {
- genericErrorstuff((long)error, kOn, 13 );
- }
- if ( paramBlock.fileParam.ioResult != noErr ) genericErrorstuff((long) paramBlock.fileParam.ioResult, kOn, 14 );
- volumeid = paramBlock.fileParam.ioVRefNum;
-
- theRow = LAddRow( 1, 2000, gpathList); /* theRow should always be zero */
- cSize.h = 0;
- cSize.v = theRow;
- offset = pathLen;
- LSetCell(listName+1, offset, cSize, gpathList);
-
- InvalRect( &badRect );
-
- /* now piece together the path from our list */
-
- for ( count=1,off=1; count<=gTopLevel; count++ ) {
- SpinCursor( 12 );
- cSize.h = 0;
- cSize.v = count;
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, gpathList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- listName[0] = dataLen+1;
- strcat( path+off, listName+1 );
- off += dataLen+1;
- path[0] = off;
- }
-
- path[0] = strlen( path+1 );
-
- listName[0]--; /* this thing gets rid of the colon */
- InsMenuItem( gPopupMenu, &listName, 0 );
- SetItemCmd( gPopupMenu, 1, 0x1e );
- if( gTopLevel == 1 ) SetItemIcon( gPopupMenu, 1, SICN_SHAR-256 );
- else SetItemIcon( gPopupMenu, 1, SICN_OPEN-256 );
-
- makedirList( path, paramBlock.fileParam.ioVRefNum );
-
- InvalRect( &badRect ); /* show the new name in the popup box */
- buildACL( );
- showRights( 0 );
- Show_Cursor( ARROW_CURSOR );
-
- }
-
- void dirSelect( short dooble )
- {
- Cell cSize, where, quack = { 0, 0 }, originalSelect;
- CInfoPBRec cInfoRec;
- HParamBlockRec paramBlock;
- OSErr error;
- Rect badRect= RECT_POPUPMENU;
- char listName[255], path[255], volumeName[255], up;
- long directoryid = 0;
- short mitem=0, volumeid, count, dataLen, pathLen,
- swapFlag = kOff;
-
- /* doobie is the way we got in... if it's zero, if was done with a keydown */
- /* event... if it's a 1, then it was done by mousedown */
- if ( dooble == 0 ) goto zero; // <- this means we entered the routine via keydown...
- GlobalToLocal( &er.where ); // otherwise, the mouse did the dirty deed
-
- if (( gWindowstats.Focus == 1 ) || ( gWindowstats.Focus == 2 )) {
- swapFocus( 0 );
- swapFlag = kOn;
- }
-
- if ( LClick( er.where, nil, dirList ) == true ) {
- godownintoDirectory( );
- } else {
- zero : if ( gAChange > 0) {
- buildACL( );
- gAChange = 0;
- }
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- where.v = (((*dirList)->dataBounds.bottom)-1);
- LSetSelect( true, where, dirList );
- }
- originalSelect = where;
- /* we go in here when we click on drive list while focus was */
- /* still on the acl list .. if something valid was selected, */
- /* don't select 0 arbitrarily... */
- if ( swapFlag == kOn ) {
- quack = LLastClick( dirList );
- /* if what we clicked on this time doesn't equal */
- /* what was selected, check to see if it's greater */
- /* than our bottom limit and if so... don't */
- /* change the selection... */
- if ( quack.v != where.v ) {
- if ( quack.v <= (*dirList)->dataBounds.bottom ) {
- LSetSelect( false, where, dirList );
- LSetSelect( true, quack, dirList );
- where.v = quack.v;
- }
- }
- }
- if ( where.v < 0 ) {
- where.v = 0;
- LSetSelect( true, where, dirList );
- }
-
- /* we go into here when we click on a new location in the drive list */
- if ( where.v != gLocation ) {
- Show_Cursor( (Cursors) ACUR_SPIN);
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, gnegAcls );
- LDoDraw( false, gnegAcls );
- LDoDraw( false, gourList );
- bzero(( char *)¶mBlock, sizeof( HParamBlockRec ));
- dataLen = 255;
- SpinCursor( 12 );
- if (gTopLevel < 1) { /* if we're on the volume level */
- LGetCell( volumeName+1, &dataLen, where, dirList );
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- where.h = 1;
- dataLen = 1;
- LGetCell( &up, &dataLen, where, dirList );
- dataLen = 255;
- LGetCell( listName+1, &pathLen, where, dirList );
- paramBlock.fileParam.ioVRefNum=-up;
- paramBlock.volumeParam.ioVolIndex = 0;
- } else {
- where.h = 1;
- dataLen = 1;
- LGetCell( &up, &dataLen, where, dirList );
- dataLen = 255;
- quack.h = 0;
- quack.v = 1; /* this retrieves the volume name from our path list */
- LGetCell( volumeName+1, &dataLen, quack, gpathList );
- paramBlock.fileParam.ioVRefNum = up;
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- paramBlock.volumeParam.ioVolIndex = -1;
- }
- paramBlock.fileParam.ioNamePtr = volumeName;
- paramBlock.fileParam.ioCompletion = 0;
- if ( error = PBHGetVInfo( ¶mBlock, false ) != noErr ) {
- genericErrorstuff((long)error, kOn, 15 );
- }
- if ( paramBlock.fileParam.ioResult != noErr ) genericErrorstuff((long)paramBlock.fileParam.ioResult, kOn, 16 );
- SpinCursor( 12 );
- volumeid = paramBlock.fileParam.ioVRefNum;
- path[1] = 0;
- if (gTopLevel > 0) { /* only do this if we're not on the top level */
- /* now piece together the path from our list */
- for ( count=1; count<=gTopLevel; count++ ) {
- SpinCursor( 12 );
- cSize.h = 0;
- cSize.v = count;
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, gpathList );
- listName[0] = dataLen+1;
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- strcat( path+1, listName+1 );
- }
- dataLen = 255;
- LGetCell( listName+1, &dataLen, originalSelect, dirList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- strcat( path+1, listName+1 );
- path[0] = strlen( path+1 );
- cInfoRec.dirInfo.ioNamePtr = path;
- cInfoRec.dirInfo.ioFDirIndex = 0;
- cInfoRec.dirInfo.ioVRefNum = volumeid;
- cInfoRec.hFileInfo.ioFVersNum = 0;
- cInfoRec.dirInfo.ioCompletion = 0;
- cInfoRec.hFileInfo.ioDirID = 0;
- if ( error = (PBGetCatInfo( &cInfoRec, false ) != noErr )) {
- genericErrorstuff((long) error, kOn, 17 );
- }
- if ( cInfoRec.dirInfo.ioResult != noErr ) genericErrorstuff((long)cInfoRec.dirInfo.ioResult, kOn, 18 );
- directoryid = cInfoRec.hFileInfo.ioDirID;
- }
- SpinCursor( 12 );
- getdirAcl( volumeid, directoryid );
- if ( gTopLevel < 2 ) buildACL( ); /* we on the volume levels, check priv */
- LDoDraw( true, gourList );
- LUpdate( dp->visRgn, gourList );
- if ( gWindowstats.State == 1 ) {
- LDoDraw( true, gnegAcls );
- LUpdate( dp->visRgn, gnegAcls );
- }
- showRights( 0 );
- Show_Cursor( ARROW_CURSOR );
- gLocation = where.v;
- }
-
- }
- }
-
- void aclSelect( short whichwayin )
- {
- Cell where = { 0, 0 };
-
- GlobalToLocal( &er.where );
- if ( whichwayin == 0 ) goto zero;
- if ( LGetSelect( true, &where, gnegAcls )) LSetSelect( false, where, gnegAcls );
- if ( gWindowstats.Focus == 0 ) swapFocus( 0 );
- if ( gWindowstats.Focus == 2 ) swapFocus( 1 );
- if ( LClick( er.where, nil, gourList ) == true) {
- /* user has clicked twice on a different acl
- so let's update the buttons officially! */
- // SysBeep( 0 ); why confuse the twits?
- }
- zero : where.h = 0;
- where.v = 0;
- if ( LNextCell( true, true, &where, gourList ) == false ) {
- showRights( 0 );
- return;
- }
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, gourList )) {
- where.v = (((*gourList)->dataBounds.bottom)-1);
- LSetSelect( true, where, gourList );
- }
- showRights( where.v ) ;
- }
-
- void negSelect( short whichwayin )
- {
- Cell where = {0, 0};
-
- GlobalToLocal( &er.where );
- if ( whichwayin == 0 ) goto zero;
-
- if ( LGetSelect( true, &where, gourList )) LSetSelect( false, where, gourList);
- if ( gWindowstats.Focus == 1 ) swapFocus( 0 );
- if ( LClick( er.where, nil, gnegAcls ) == true) {
- SysBeep( 0 );
- }
- zero : where.h = 0;
- where.v = 0;
- if ( LNextCell( true, true, &where, gnegAcls ) == false ) {
- showRights( 0 );
- return;
- }
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, gnegAcls )) {
- where.v = (((*gnegAcls)->dataBounds.bottom)-1);
- LSetSelect( true, where, gnegAcls );
- }
- showRights( where.v ) ;
- }
-
- void createNegAclBox( void ){
-
- Cell celljack = { 0, 0 };
- FontInfo fontStuff;
- Handle nothingspecial;
- Point inbetween, cellsz;
- Rect boogieRect, myRect={0, 0, 0, 0}, nobox;
- short boxthebutton;
-
- LDoDraw( false, gourList );
- LDoDraw( false, gnegAcls );
-
- gWindowstats.State = 1;
- boogieRect = dp->portRect;
- boogieRect.left = ((*gourList)->rView.left)-4;
- boogieRect.right = ((*gourList)->rView.right)+22;
-
- EraseRect( &boogieRect );
- ClipRect( &myRect );
-
- if ( gWindowstats.Focus == 1 ) { /* this code erases the focus box */
- myRect = (*gourList)->rView;
- myRect.right+=15;
- InsetRect( &myRect, -4, -4);
- PenSize( 2, 2 );
- ForeColor( whiteColor );
- FrameRect( &myRect );
- ForeColor( blackColor );
- PenSize( 1, 1 );
- }
-
- HideControl(( *gourList)->vScroll );
- HideControl(( *gnegAcls)->vScroll );
-
- myRect = (*gourList)->rView;
- boogieRect = myRect;
- InsetRect( &boogieRect, -4, -4 );
- EraseRect( &boogieRect );
-
- inbetween.h = myRect.right;
- inbetween.v = myRect.bottom;
-
- myRect.bottom = ( myRect.bottom / 2 );
-
- GetFontInfo( &fontStuff );
-
- boogieRect = (*gourList)->rView;
- inbetween.h = boogieRect.right;
- cellsz.h = myRect.right-myRect.left;
- cellsz.v = fontStuff.ascent+fontStuff.descent+fontStuff.leading;
- LCellSize( cellsz, gourList );
- LSize(( myRect.right-myRect.left ), ( myRect.bottom-myRect.top ), gourList);
-
- (*gourList)->rView.right = myRect.right;
- (*gourList)->rView.top = myRect.top;
- (*gourList)->rView.bottom = myRect.bottom;
- (*gourList)->rView.left = myRect.left;
-
- MoveControl(( *gourList)->vScroll, myRect.right+1, myRect.top-1 );
- SizeControl(( *gourList)->vScroll, 15, myRect.bottom-myRect.top+2 );
- myRect.right=myRect.right+15;
- GetDItem( dp, ITEM_SECONDBOX, &boxthebutton, ¬hingspecial, &nobox );
- SetDItem( dp, ITEM_SECONDBOX, boxthebutton, (Handle)secondBox, &myRect );
- myRect.right=myRect.right-15;
-
- GetDItem( dp, ITEM_NEGTITLE, &boxthebutton, ¬hingspecial, &nobox );
- nobox.top = myRect.bottom+5;
- nobox.bottom = myRect.bottom+23;
- nobox.left = myRect.left;
- nobox.right = myRect.left+132;
- SetDItem( dp, ITEM_NEGTITLE, boxthebutton, (Handle)negativeBox, &nobox );
- ShowDItem( dp, ITEM_NEGTITLE );
-
- myRect.top = myRect.bottom+30;
- myRect.bottom = ( dp->portRect.bottom-38 );
-
- boogieRect = (*gnegAcls)->rView;
- inbetween.h = boogieRect.right;
- HideControl(( *gnegAcls)->vScroll );
- cellsz.h = myRect.right-myRect.left;
- cellsz.v = fontStuff.ascent+fontStuff.descent+fontStuff.leading;
- LCellSize( cellsz, gnegAcls );
- LSize( myRect.right-myRect.left, myRect.bottom-myRect.top, gnegAcls);
-
- (*gnegAcls)->rView.right = myRect.right;
- (*gnegAcls)->rView.top = myRect.top;
- (*gnegAcls)->rView.bottom = myRect.bottom;
- (*gnegAcls)->rView.left = myRect.left;
-
- MoveControl(( *gnegAcls)->vScroll, myRect.right+1, myRect.top-1 );
- SizeControl(( *gnegAcls)->vScroll, 15, myRect.bottom-myRect.top+2 );
- myRect.right=myRect.right+15;
- GetDItem( dp, ITEM_NEGBOX, &boxthebutton, ¬hingspecial, &nobox );
- SetDItem( dp, ITEM_NEGBOX, boxthebutton, (Handle)bonusBox, &myRect );
- ShowDItem( dp, ITEM_NEGBOX );
-
- LGetSelect( true, &celljack, gnegAcls );
- LSetSelect( false, celljack, gnegAcls );
-
- LDoDraw( true, gourList );
- LDoDraw( true, gnegAcls );
-
- ClipRect( &dp->portRect );
- InvalRect( &dp->portRect );
- SetItem( gOptions, 1, "\pHide Negative Access" );
- }
-
- short negdelDecision( void )
- {
- short itemHit = 0, okbuttontype, bitethisflag = 0;
- DialogPtr dr;
- Rect numberbox;
- Handle number;
-
- if (( dr = GetNewDialog( DLOG_NEGDEL, NULL, (WindowPtr)-1 )) == NULL ) {
- genericErrorstuff( -66670, kOff, 130 );
- ExitToShell();
- }
- SetPort( dr );
- ShowWindow( dr );
-
- GetDItem( dr, ITEM_OK, &okbuttontype, &number, &numberbox );
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
- SysBeep( 0 );
- ModalDialog( nil, &itemHit );
- switch( itemHit ) {
- case 1 : /* hit OK button */
- DisposDialog( dr );
- return 1;
- break;
- case 2 : /* hit CANCEL button */
- DisposDialog( dr );
- return 0;
- break;
- }
- }
-
- void deleteNegAclBox( void ){
-
- Cell celljack = { 0, 0 };
- Handle nothingspecial;
- Point inbetween, cellsz;
- Rect boogieRect, myRect = { 0, 0, 0, 0 }, nobox;
- short boxthebutton;
-
- if (( LNextCell( true, true, &celljack, gnegAcls ) == true ) && ( gWindowstats.Permit == kOn )) {
- if ( negdelDecision( ) == 0 ) return;
- SetPort( dp );
- LDoDraw( false, gnegAcls );
- LDelRow( 0, 2000, gnegAcls );
- LGetSelect( true, &celljack, dirList );
- gAChange = celljack.v+1;
- celljack.v = 0;
- celljack.h = 0;
- }
-
- // switch back to positive only state....
- gWindowstats.State = 0;
- LDoDraw( false, gourList );
- LDoDraw( false, gnegAcls );
-
- boogieRect = dp->portRect;
- boogieRect.left = ((*gourList)->rView.left)-4;
- boogieRect.right = ((*gourList)->rView.right)+4;
-
- EraseRect( &boogieRect );
- ClipRect( &myRect );
-
- // insure that the crap in here is really history before you
- // make it history.... which the LDelRow call below does....
-
- if ( gWindowstats.Focus == 1 ) { /* this code erases the focus box */
- myRect = (*gourList)->rView;
- myRect.right+=15;
- InsetRect( &myRect, -4, -4);
- PenSize( 2, 2 );
- ForeColor( whiteColor );
- FrameRect( &myRect );
- ForeColor( blackColor );
- PenSize( 1, 1 );
- }
-
- if ( gWindowstats.Focus == 2 ) { /* this code erases the focus box */
- myRect = (*gnegAcls)->rView;
- myRect.right+=15;
- InsetRect( &myRect, -4, -4);
- PenSize( 2, 2 );
- ForeColor( whiteColor );
- FrameRect( &myRect );
- ForeColor( blackColor );
- PenSize( 1, 1 );
- gWindowstats.Focus = 1;
- }
-
- myRect = (*gourList)->rView;
- myRect.bottom = dp->portRect.bottom;
-
- HideControl(( *gourList)->vScroll );
- HideControl(( *gnegAcls)->vScroll );
- HideDItem( dp, ITEM_NEGTITLE );
- HideDItem( dp, ITEM_NEGBOX );
-
- myRect = dp->portRect;
-
- myRect.top = 25;
- myRect.bottom = myRect.bottom - 40;
-
- boogieRect = (*gourList)->rView;
- myRect.left = boogieRect.left;
- myRect.right = boogieRect.right;
-
- inbetween.h = myRect.right;
- inbetween.v = myRect.bottom;
-
- cellsz.h = myRect.right-myRect.left;
- cellsz.v = (*gourList)->cellSize.v;
- LCellSize( cellsz, gourList );
- LSize(( myRect.right ), ( myRect.bottom ), gourList);
-
- (*gourList)->rView.right = myRect.right;
- (*gourList)->rView.top = myRect.top;
- (*gourList)->rView.bottom = myRect.bottom;
- (*gourList)->rView.left = myRect.left;
-
- MoveControl(( *gourList)->vScroll, myRect.right+1, myRect.top-1 );
- SizeControl(( *gourList)->vScroll, 15, myRect.bottom-myRect.top+2 );
- myRect.right=myRect.right+15;
- GetDItem( dp, ITEM_SECONDBOX, &boxthebutton, ¬hingspecial, &nobox );
- SetDItem( dp, ITEM_SECONDBOX, boxthebutton, (Handle)secondBox, &myRect );
- LDoDraw( true, gourList );
-
- ClipRect( &dp->portRect );
- InvalRect( &dp->portRect );
- SetItem( gOptions, 1, "\pShow Negative Access" );
- }
-
- void gotoToplevel( void ){
-
- int theRow;
- short count;
- Point cSize;
-
- SetPort( dp );
-
- // user is going up to desktop level.... so delete everything except the "desktop" menu choice
- for ( count=(CountMItems( gPopupMenu )); count>1 ; count--)
- DelMenuItem( gPopupMenu, 1 );
- gTopLevel = 0;
- SpinCursor( 6 );
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, dirList );
- LDelRow( 0, 2000, gnegAcls );
- LDelRow( 0, 2000, gpathList );
- gInitialize = kOff;
- gManyAcls = 0;
- makeList ( );
- gInitialize = kOn;
- theRow = LAddRow(1, 2000, gpathList); /* theRow should always be zero */
- cSize.h = 0;
- cSize.v = theRow;
- LSetCell("Desktop", 7, cSize, gpathList);
-
- }
-
- void popupPlay( void ){
-
- Cell where, cSize;
- Point topleft;
- short dataLen, count, mitem = 0, RealResult;
- long Result, directoryid = 0, volumeid, menuwidth;
- int PopUpItem = 0, theRow;
- char volumeName[255], path[255];
- Str255 listName;
- HParamBlockRec paramBlock;
- Rect badRect = RECT_POPUPMENU;
- short number, anothernum;
-
- topleft = er.where;
- GlobalToLocal( &topleft );
-
- // don't bring down the popupmenu unless the user has clicked inside the popupmenu rect
- if( topleft.h > ( badRect.left + (*gPopupMenu)->menuWidth )) return;
-
- /* now reset topleft for two konstants which tell the Mac where to place the popupmenu */
- topleft.v = badRect.top+1;
- topleft.h = badRect.left;
- LocalToGlobal( &topleft );
-
- InsertMenu( gPopupMenu, -1 );
- menuwidth = (*gPopupMenu)->menuWidth;
- Result = PopUpMenuSelect( gPopupMenu, topleft.v, topleft.h, PopUpItem );
-
- RealResult = (Result & 0xffff);
- (*gPopupMenu)->menuWidth = menuwidth;
-
- // user wants to go UP????
- if ( RealResult > 1 ) {
- Show_Cursor((Cursors) ACUR_SPIN );
- if ( gAChange > 0) {
- buildACL( );
- gAChange = 0;
- }
- InvalRect( &badRect );
- if ((gTopLevel+1 - RealResult ) <= 0) {
- gotoToplevel( );
- } else {
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, dirList );
- LDelRow( 0, 2000, gnegAcls );
- dataLen = 255;
- where.h = 0;
- where.v = 1; /* this retrieves the volume name from our path list */
- LGetCell( volumeName+1, &dataLen, where, gpathList );
- volumeName[0] = dataLen+1;
- volumeName[dataLen+1] = ':';
- SpinCursor( 6 );
- paramBlock.fileParam.ioNamePtr = volumeName;
- paramBlock.fileParam.ioVRefNum = 0;
- paramBlock.fileParam.ioCompletion = 0;
- paramBlock.volumeParam.ioVolIndex = -1;
- if ( PBHGetVInfo( ¶mBlock, false ) != noErr ) {
- genericErrorstuff( -66670, kOn, 140 );
- }
- if ( paramBlock.fileParam.ioResult != noErr ) genericErrorstuff((long)paramBlock.fileParam.ioResult, kOn, 141 );
- volumeid = paramBlock.fileParam.ioVRefNum;
- theRow = (gTopLevel+1 - RealResult ); /* theRow should always be zero */
- cSize.h = 0;
- cSize.v = theRow;
-
- /* now piece together the path from our list */
- path[0] = path[1] = 0;
- gTopLevel = (CountMItems( gPopupMenu ) - RealResult );
- for ( count=1; count<=(CountMItems( gPopupMenu ) - RealResult ); count++ ) {
- SpinCursor( 6 );
- cSize.h = 0;
- cSize.v = count;
- dataLen = 255;
- LGetCell( listName+1, &dataLen, cSize, gpathList );
- listName[dataLen+1] = ':';
- listName[dataLen+2] = 0;
- listName[0] = dataLen+1;
- strcat( path+1, listName+1 );
- }
- path[0] = strlen( path+1 );
-
- anothernum = (CountMItems( gPopupMenu ));
- number = (anothernum - ( anothernum - RealResult + 1 ));
- anothernum--;
- // delete pieces of the pop-up menu and pathlist that are gone...
- for ( count=0; count<number; count++){
- DelMenuItem( gPopupMenu, 1 );
- LDelRow( 1, anothernum--, gpathList );
- }
- makedirList( path, volumeid );
- buildACL( );
- } /* end else */
- gLocation = 0;
- InvalRect( &badRect );
- Show_Cursor( ARROW_CURSOR );
- }
- DeleteMenu( MENU_POPUP );
- }
-
- void doDialog( short item )
-
- {
- Cell where;
- short mitem = 0;
- long directoryid = 0;
- Point topleft;
- int PopUpItem = 0;
- Rect badRect = RECT_POPUPMENU;
-
- topleft.h = 9;
- topleft.v = 2;
- SetPort( dp );
- switch( item ) {
- case 1 : /* clicking on the drive/volume list */
- dirSelect( 1 );
- break;
-
- case 2 : /* clicking in the acl list */
- aclSelect( 1 );
- break;
-
- case ITEM_NEGBOX : // clicking in the negative ACL box...
- if ( gWindowstats.Focus != 2 ) swapFocus( 2 );
- if ( gWindowstats.State == 1 ) { // just to be sure that the pos/neg state is enabled....
- negSelect( 1 );
- }
- break;
-
- case 10 : /* the add group button */
- addGroup( );
- break;
-
- case 11 : /* the remove group button */
- deleteGroup( );
- break;
-
- case 12 : /* in the popup menu box */
-
- popupPlay( );
- break;
-
- case 3 : /* read */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 3, where.v, 1 );
- break;
-
- case 4 : /* write */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 4, where.v, 2 );
- break;
-
- case 5 : /* insert */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 5, where.v, 4 );
- break;
-
- case 6 : /* lookup */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 6, where.v, 8 );
- break;
-
- case 7 : /* lookup */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 7, where.v, 16 );
- break;
-
- case 8 : /* lookup */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 8, where.v, 32 );
- break;
-
- case 9 : /* administer */
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- resetPerm( 9, where.v, 64 );
- break;
- }
- }
-
- void doMenu( long whichMenuItem )
-
- {
- short hi, lo;
- Str255 itemString ; /* the DA's official name */
-
- hi = ((whichMenuItem & 0xffff0000) >> 16) ;
- lo = (whichMenuItem & 0xffff) ;
-
- if ((hi == MENU_APPLE) && (lo == 1)) { /* About!! */
- /* check out these credits... */
- aboutPriv() ;
- HiliteMenu( 0 ) ;
-
- } /* end in about... */
-
- if ((hi == MENU_APPLE) && (lo >= 3)) { /* select a DA? */
- GetItem (gApplemenu, lo, itemString) ;
- OpenDeskAcc (itemString) ;
- HiliteMenu( 0 ) ;
- }
-
- if ((hi == kHMHelpMenuID ) && ( lo >= 3 )) {
-
- showInfoDialog( );
-
- }
-
- if ((hi == MENU_FILE && lo == 1)) { /* QUIT selected */
- shouldireallyquit( );
- }
-
- if (( hi == MENU_OPTION && lo == 1 )){ /* show or hide the negative acl box */
- if( gWindowstats.State == 0 ){
- createNegAclBox( );
- } else {
- deleteNegAclBox( );
- }
- HiliteMenu( 0 );
- }
-
- if ( hi == MENU_CONVIN ){
- instagroovyAcls( lo );
- HiliteMenu( 0 );
- }
-
- } /* end WhatToDoInMenu function */
-
-
- void aboutPriv( )
- {
- short flag = kOff, itemHit = 0, okbuttontype;
- Rect numberbox = { 0, 0, 0, 0 };
- Handle number;
- Str255 whatImean = "\pElvis Lives!!!";
-
- if ( er.modifiers & optionKey ) { /* it is a cmd key function */
- flag = kOn;
- }
-
- if( flag == kOn ){
- if (( dr = GetNewDialog( DLOG_ELVS, NULL, (WindowPtr)-1 )) == NULL ) {
- goto failt;
- }
- GetDItem( dr, OKBUTTON, &okbuttontype, &number, &numberbox );
- } else {
- failt: if (( dr = GetNewDialog( DLOG_ABOUT, NULL, (WindowPtr)-1 )) == NULL ) {
- genericErrorstuff( 0, kOff, 23 );
- }
- GetDItem( dr, OKBUTTON, &okbuttontype, &number, &numberbox );
- if ( flag == kOn ) SetCTitle((ControlHandle)number, whatImean);
- }
-
-
- SetPort( dr );
- ShowWindow( dr );
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
-
- ModalDialog( nil, &itemHit );
-
- DisposDialog( dr );
- SetPort( dp );
- }
-
- pascal void firstBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused ( itemNo );
- Rect firstbox;
-
- firstbox = (*dirList)->rView;
- firstbox.top--;
- firstbox.bottom++;
- firstbox.right=firstbox.right+16;
- firstbox.left--;
- FrameRect( &firstbox );
- if ( gWindowstats.Focus == 0 ) { /* focus is on this box */
- PenSize(2,2);
- InsetRect( &firstbox, -3, -3);
- ForeColor( blackColor );
- FrameRect( &firstbox );
- PenSize(1,1);
- }
- LUpdate( theWindow->visRgn, dirList );
- return;
- }
-
- pascal void secondBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
-
- Rect myRect, thebox;
-
- LUpdate( theWindow->visRgn, gourList );
- /* this part draws the rect that surrounds the list */
- thebox = (*gourList)->rView;
- thebox.top--;
- thebox.bottom++;
- thebox.right=thebox.right+16;
- thebox.left--;
- FrameRect( &thebox );
- myRect = thebox;
- ForeColor( whiteColor );
- PenSize( 2, 2);
- InsetRect( &myRect, -2, -2);
- FrameRect( &myRect );
- ForeColor( blackColor );
- PenSize( 1, 1 );
- if ( gWindowstats.Focus == 1 ) { /* focus is on THIS box... */
- PenSize(2,2);
- InsetRect( &thebox, -3, -3);
- ForeColor( blackColor );
- FrameRect( &thebox );
- PenSize(1,1);
- }
- return;
- }
-
- pascal void bonusBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
-
- Rect myRect, thebox;
- FontInfo fontStuff;
- short fontNum;
-
- if ( gWindowstats.State == 1 ) {
- GetFNum((StringPtr)"\pChicago",&fontNum); // I do this in case the font has been mucked with
- TextFont(fontNum);
- TextFace(0);
- TextSize(12);
- GetFontInfo(&fontStuff);
-
- LUpdate( theWindow->visRgn, gnegAcls );
- /* this part draws the rect that surrounds the list */
- thebox = (*gnegAcls)->rView;
- thebox.top--;
- thebox.bottom++;
- thebox.right=thebox.right+16;
- thebox.left--;
- FrameRect( &thebox );
- myRect = thebox;
- ForeColor( whiteColor );
- PenSize( 2, 2);
- InsetRect( &myRect, -2, -2);
- FrameRect( &myRect );
- ForeColor( blackColor );
- PenSize( 1, 1 );
- if ( gWindowstats.Focus == 2 ) { /* focus is on THIS box... */
- PenSize(2,2);
- InsetRect( &thebox, -3, -3);
- ForeColor( blackColor );
- FrameRect( &thebox );
- PenSize(1,1);
- }
- }
- return;
- }
-
- pascal void growBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
- Rect box;
- RgnHandle rgn;
-
- SetPort( dp );
- box = ((GrafPtr) dp)->portRect;
- box.left = box.right - 15;
- box.top = box.bottom - 15;
- rgn=NewRgn( );
- GetClip( rgn );
- ClipRect(&box);
- DrawGrowIcon( dp );
- SetClip( rgn );
- DisposeRgn( rgn );
- }
-
- pascal void popupBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
-
- Cell place;
- short dataLen, fontNum;
- int textpixelsize, charpixelsize;
- char volumeName[255];
- Rect box, wholebox = RECT_POPUPMENU;
- FontInfo allaboutChicago;
- SICNHand sicnhandle;
- Str255 namedisplayed;
- short textswidth;
-
- SetPort( dp );
- dataLen = 255; /* the length will be corrected to the real thing when we get the cell */
- place.h = 0;
- place.v = gTopLevel; /* this is set to whatever level we are at... 0 for top */
- LGetCell( namedisplayed+1, &dataLen, place, gpathList );
- namedisplayed[0] = dataLen;
- GetFNum((StringPtr)"\pChicago",&fontNum); /* set our font */
- TextFont(fontNum);
- TextFace(0);
- TextSize(12);
- GetFontInfo( &allaboutChicago );
- textpixelsize = StringWidth( volumeName );
- charpixelsize = CharWidth( ' ' );
- CalcMenuSize( gPopupMenu );
- box.top = wholebox.top;
- box.left = wholebox.left;
- box.bottom = 2+1+allaboutChicago.ascent+allaboutChicago.descent+allaboutChicago.leading;
- TruncString(( wholebox.right - wholebox.left - ( SIZEOFSICN * 2 )), &namedisplayed, smTruncEnd );
- textswidth = ( StringWidth( namedisplayed ) + ( SIZEOFSICN * 2))-7;
- box.right = ( box.left + textswidth );
- EraseRect( &wholebox );
- InsetRect( &box, -1, -1 );
- box.top++;
- box.bottom = wholebox.top+20;
- wholebox = box;
-
- // I don't know why these SICNS behave this way... I just kludged it...
- if( gTopLevel == 0 ) wholebox.top = wholebox.top+3;
- else wholebox.top = wholebox.top+2;
-
- wholebox.left = wholebox.left+15;
- wholebox.right = wholebox.left + 16;
- wholebox.bottom = wholebox.top + 16;
- if( gTopLevel == 0 ) sicnhandle = (SICNHand)GetResource( 'SICN', SICN_DESK );
- if( gTopLevel == 1 ) sicnhandle = (SICNHand)GetResource( 'SICN', SICN_SHAR );
- if( gTopLevel > 1 ) sicnhandle = (SICNHand)GetResource( 'SICN', SICN_OPEN );
- HLock((Handle) sicnhandle );
- PlotSICN( &wholebox, sicnhandle, 0 );
- HUnlock((Handle) sicnhandle );
- FrameRect( &box );
- MoveTo( box.left+3 , box.bottom); /* moves to the bottom of the Rectangle */
- PenSize( 1, 1);
- LineTo((box.left+textswidth+2), box.bottom);
- LineTo((box.left+textswidth+2), box.top+2);
- MoveTo( box.left+35,( box.bottom-allaboutChicago.descent-allaboutChicago.leading-2) );
- DrawString( &namedisplayed );
- wholebox.left = ( box.left + 4 + StringWidth( namedisplayed ) + SIZEOFSICN );
- wholebox.top = box.top+2;
- wholebox.bottom = wholebox.top+16;
- wholebox.right = wholebox.left + 16;
- sicnhandle = (SICNHand)GetResource( 'SICN', SICN_DOWN );
- HLock((Handle) sicnhandle );
- PlotSICN( &wholebox, sicnhandle, 0 );
- HUnlock((Handle) sicnhandle );
- }
-
- pascal void posornegBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
-
- short fontNum, boxthebutton;
- int textpixelsize, charpixelsize;
- FontInfo allaboutChicago;
- Handle nothingspecial;
- Rect box;
-
- SetPort( dp );
- GetDItem( dp, ITEM_POSITIVE, &boxthebutton, ¬hingspecial, &box );
- GetFNum((StringPtr)"\pChicago",&fontNum); /* set our font */
- TextFont(fontNum);
- TextFace(0);
- TextSize(12);
- GetFontInfo( &allaboutChicago );
- textpixelsize = StringWidth( "\pPositive Access" );
- charpixelsize = CharWidth( ' ' );
- box.bottom = box.top + 18;
- box.right = box.left + 132;
-
- EraseRect( &box );
-
- MoveTo( box.left+1 , box.top+9); /* moves to the bottom of the Rectangle */
- PenPat( &qd.gray );
- PenSize( 1, 1);
- LineTo( box.left+14, box.top+9 );
- MoveTo( box.right-9, box.top+9 );
- LineTo( box.right+2, box.top+9);
- PenPat( &qd.black );
- MoveTo( box.left+16 , (box.bottom-allaboutChicago.descent-allaboutChicago.leading-1));
- DrawString( "\pPositive Access" );
-
- }
-
- pascal void negativeBox( theWindow, itemNo )
- WindowPtr theWindow;
- short itemNo;
- {
- #pragma unused (theWindow, itemNo );
-
- short fontNum, boxthebutton;
- int textpixelsize, charpixelsize;
- FontInfo allaboutChicago;
- Handle nothingspecial;
- Rect box;
-
- if ( gWindowstats.State == 1 ) {
- SetPort( dp );
- GetDItem( dp, ITEM_NEGTITLE, &boxthebutton, ¬hingspecial, &box );
- GetFNum((StringPtr)"\pChicago",&fontNum); /* set our font */
- TextFont(fontNum);
- TextFace(0);
- TextSize(12);
- GetFontInfo( &allaboutChicago );
- textpixelsize = StringWidth( "\pNegative Access" );
- charpixelsize = CharWidth( ' ' );
- GetDItem( dp, ITEM_SECONDBOX, &boxthebutton, ¬hingspecial, &box );
- box.top = box.bottom + 5;
- box.bottom = box.top + 18;
- box.right = box.left + 132;
-
- EraseRect( &box );
-
- MoveTo( box.left+1 , box.top+9); /* moves to the bottom of the Rectangle */
- PenPat( &qd.gray );
- PenSize( 1, 1);
- LineTo( box.left+15, box.top+9 );
- MoveTo( box.right-9, box.top+9 );
- LineTo( box.right+2, box.top+9);
- PenPat( &qd.black );
- MoveTo( box.left+16 , (box.bottom-allaboutChicago.descent-allaboutChicago.leading-1));
- DrawString( "\pNegative Access" );
- }
- }
-
- OSErr GetIndVolume(short whichVol, char *volName, short *volRefNum)
- {
- /* return the name and vRefNum of volume specified by whichVol. */
-
- HVolumeParam volPB;
- OSErr error;
-
- volPB.ioNamePtr = volName; /* make sure it returns the name */
- volPB.ioVRefNum = 0; /* 0 means use ioVolIndex */
- volPB.ioVolIndex = whichVol; /* use this to determine the volume */
-
- error = PBHGetVInfo( (HParmBlkPtr)&volPB,false ); /* do it */
- if (error == noErr) /* if no error occurred */
- *volRefNum = volPB.ioVRefNum; /* return the volume reference */
-
- /* other information is available from this record; see the FILE */
- /* Manager's description of PBHGetVInfo for more details... */
-
- return(error); /* always return error code */
- } /* GetIndVolume */
-
- void bzero( char *p, long len ) /* cleans out a pointer so that we pass */
- /* only the information we want to */
- char *p; /* PBHDelete */
- long len;
- {
- for ( ; len > 0; --len ) {
- *p++ = 0;
- }
- }
-
- void makeList( )
- {
- /* create the list of mounted volumes.... */
-
- short whichVol, volRefNum = 0, length, numberoflistentries = 0;
- short countAfs = 1, k, howmany;
- char volName[255], up;
- OSErr whaterror;
- Rect box = { 32, 9, 32+130, 9+163-15 }, bounds;
- Point place;
- Cell whatbox;
- HParamBlockRec audioCheck;
-
- Show_Cursor((Cursors) ACUR_SPIN);
- LDoDraw( false, gourList );
- LDoDraw( false, dirList );
- for(k=0;k<255;k++) {
- volName[k] = 0;
- }
-
- bounds = box;
- place.h = box.left;
- place.v = box.top;
- howmany = 0;
-
- for (whichVol=1;;whichVol++) {
- if (GetIndVolume( whichVol, volName, &volRefNum) == nsvErr) break;
- vcb = (AVCB *)(getVCBbyrefnum( volRefNum ));
- SpinCursor( 8 );
- if (isafsVCB( vcb ) == true) {
- bzero(( char *)&audioCheck, sizeof( HParamBlockRec ));
- audioCheck.fileParam.ioCompletion = nil;
- audioCheck.fileParam.ioNamePtr = volName;
- audioCheck.fileParam.ioVRefNum = volRefNum;
- if( whaterror = PBHGetVInfo( &audioCheck, false ) != noErr ){
- genericErrorstuff((long)whaterror, kOn, 19 );
- }
- if (!( audioCheck.volumeParam.ioVFSID & 0x4A48 )){
- length = volName[0];
- if (getdirAcl( volRefNum, OBNOXIOUSHIGHNUMBER ) == true) {
- up = -volRefNum;
- CompareandInsert( volName, up, numberoflistentries++ );
- howmany++;
- }
- }
- }
- }
- if ( howmany == 0 ) {
- Show_Cursor( ARROW_CURSOR );
- noAFSmounted( );
- return;
- }
-
- whatbox.h = 0; /* we should always be in here as we just */
- whatbox.v = 0; /* rebuilt the damned directory list... */
- if ( !LGetSelect( true, &whatbox, dirList )) {
- LSetSelect( true, whatbox, dirList );
- }
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, gnegAcls );
- whatbox.h = 1;
- length=1;
- LGetCell( &up, &length, whatbox, dirList );
- if( getdirAcl( -up, 0 ) == false ){
- /* this should never be false since it's already in our list
- * as an AFS volume */
- genericErrorstuff(-66669, kOn, 55 );
- }
-
- buildACL( );
-
- LDoDraw( true, dirList );
- LUpdate( dp->visRgn, dirList );
- LDoDraw( true, gourList );
- LUpdate( dp->visRgn, gourList );
- if ( gWindowstats.State == 1 ) {
- LDoDraw( true, gnegAcls );
- LUpdate( dp->visRgn, gnegAcls );
- }
- gLocation = 0;
- showRights( 0 );
- Show_Cursor( ARROW_CURSOR );
- return;
- }
-
- short CompareandInsert( char listentry[255], char up, short entriesinlist ){
-
- Boolean endflag;
- Cell wherearewe = { 0, 0 };
- short dataLen, length;
- int j;
- short cameback;
-
- Str255 checking, comparedto;
-
- strncpy( checking+1, listentry+1, listentry[0] );
- checking[0] = listentry[0];
- UprString( &checking, false );
-
- if( entriesinlist == 0 ) endflag = false;
- else endflag = true;
-
- wherearewe.v = 0;
- do {
- dataLen = 512;
- wherearewe.h = 0;
- if( endflag != false ) {
- LGetCell( comparedto+1, &dataLen, wherearewe, dirList );
- comparedto[0] = dataLen;
- comparedto[dataLen+1] = 0;
- UprString( &comparedto, false );
- if( cameback = ( IUCompString( checking, comparedto )) < 0 ) endflag = false;
- else endflag = LNextCell( false, true, &wherearewe, dirList );
- }
- } while ( endflag == true );
-
- listentry[listentry[0]+1] = 0;
- length = strlen( listentry + 1 );
- if( length <= 0 ) return 0;
- wherearewe.v = LAddRow( 1, wherearewe.v, dirList );
- LSetCell( listentry+1, length, wherearewe, dirList);
- wherearewe.h = 1;
- j = 1;
- LSetCell( &up, j, wherearewe, dirList );
- return 0;
- }
-
- void makedirList( Str255 path, long vRefNum )
- {
-
- CInfoPBRec paramBlock;
- long whatthehell, tempfolderid, directoryid, volumeid;
- WDPBRec wdBlock;
- OSErr reportCode;
- char neato[255], listentry[255], up;
- Cell whatbox;
- short count=0, countDir = 0, howmany, length, alpha, numberoflistentries = 0;
-
- // I'm spinning the cursor because I'm assuming we have a spinning watch at this point
- Show_Cursor((Cursors) ACUR_SPIN);
- bzero((char *)¶mBlock, sizeof( CInfoPBRec ));
- volumeid = vRefNum;
- wdBlock.ioVRefNum = vRefNum;
- wdBlock.ioWDIndex = 0;
- wdBlock.ioWDProcID = 0;
- SpinCursor( 8 );
- LDelRow( 0, 2000, dirList ); /* deletes everything in the list */
- LDoDraw( false, dirList );
- paramBlock.hFileInfo.ioNamePtr = path;
- paramBlock.hFileInfo.ioVRefNum = vRefNum;
- paramBlock.hFileInfo.ioCompletion = 0;
- paramBlock.hFileInfo.ioFDirIndex = 0;
- paramBlock.hFileInfo.ioDirID = 0;
- if ( whatthehell = (PBGetCatInfo( ¶mBlock, false ) != noErr )) {
- genericErrorstuff( whatthehell, kOff, 20 );
- }
- if ( paramBlock.hFileInfo.ioResult != noErr ) genericErrorstuff((long) paramBlock.hFileInfo.ioResult, kOff, 21 );
- tempfolderid = paramBlock.hFileInfo.ioDirID;
- howmany = 0;
- do {
- SpinCursor( 12 );
- for (alpha=0;alpha<255;alpha++) {
- listentry[alpha] = neato[alpha] = 0;
- }
-
- if ( buildLoop( ) == 1 ){
- SysBeep( 0 );
- break;
- }
- paramBlock.hFileInfo.ioFDirIndex = ++count;
- paramBlock.hFileInfo.ioDirID = tempfolderid;
- paramBlock.hFileInfo.ioVRefNum = vRefNum;
- paramBlock.hFileInfo.ioNamePtr = neato;
- paramBlock.hFileInfo.ioFVersNum = 0;
- paramBlock.hFileInfo.ioCompletion = 0L;
- reportCode = PBGetCatInfo( ¶mBlock, false );
- if( reportCode = paramBlock.hFileInfo.ioResult != noErr ); /* I don't discard this error,
- we merely hold it until the
- end of the while loop and if
- there IS an error, get out!*/
-
- if( BitTst(¶mBlock.hFileInfo.ioFlAttrib,3) == true ) { /* tests to see if the "file" is */
- /* a directory, which is the only thing you can set acls on in afs-land... */
- length = strlen( neato );
- neato[length+1]=0;
- for(alpha=0;alpha<=length;alpha++) {
- listentry[alpha+1] = neato[alpha];
- }
- SpinCursor( 12 );
- listentry[0] = length;
- neato[0] = length;
- whatbox.h = 0;
- if ( countDir == 0 ) directoryid = paramBlock.hFileInfo.ioDirID;
- whatbox.v = countDir++ - 1;
- if ( length > 1 ) {
- up = paramBlock.hFileInfo.ioDirID;
- listentry[1]=listentry[0];
- CompareandInsert( listentry+1, up, numberoflistentries++ );
- howmany++;
- } /* end if-length check */
- }
- } while ( reportCode == noErr );
- LDoDraw( true, dirList );
- LUpdate( dp->visRgn, dirList );
-
- whatbox.h = 0; /* we should always be in here as we just */
- whatbox.v = 0; /* rebuilt the damned directory list... */
- if ( !LGetSelect( true, &whatbox, dirList )) {
- LSetSelect( true, whatbox, dirList );
- }
- LDelRow( 0, 2000, gourList ); /* deletes everything in the acl list */
- LDelRow( 0, 2000, gnegAcls );
-
- if( howmany > 0 ){
- whatbox.h = 1;
- length=1;
- LGetCell( &up, &length, whatbox, dirList );
- if( getdirAcl( volumeid, up ) == false ){
- /* this should never be false since it's already in our list
- * as an AFS volume */
- genericErrorstuff(-66669, kOn, 58 );
- }
- }
- LDoDraw( true, gourList );
- LUpdate( dp->visRgn, gourList );
- if ( gWindowstats.State == 1 ) {
- LDoDraw( true, gnegAcls );
- LUpdate( dp->visRgn, gnegAcls );
- }
- gLocation = 0;
- showRights( 0 );
- Show_Cursor( ARROW_CURSOR );
- return;
- }
-
- void shouldireallyquit( void ){
-
- Handle number;
- Rect numberbox;
- short okbuttontype, itemHit;
-
- if ( gAChange <= 0) termiNate( );
-
- if (( dr = GetNewDialog( DLOG_QUIT, NULL, (WindowPtr)-1 )) == NULL ) {
- ExitToShell();
- }
-
- SetPort( dr );
- ShowWindow( dr );
-
- GetDItem( dr, 1, &okbuttontype, &number, &numberbox );
-
- PenSize(3,3);
- InsetRect(&numberbox,-4,-4);
- FrameRoundRect(&numberbox,16,16);
- SysBeep( 0 );
- ModalDialog( nil, &itemHit );
- switch( itemHit ) {
- case 1 : /* hit the Save button */
- DisposDialog( dr );
- buildACL( );
- termiNate( );
- break;
- case 2 : /* hit the Don't Save button */
- DisposDialog( dr );
- termiNate( );
- break;
- case 3 : /* hit the cancel button */
- DisposDialog( dr );
- SetPort( dp );
- return;
- break;
- }
-
-
- }
-
- Boolean getdirAcl( short volRefNum, long directid )
- {
- Str255 foldName;
- XPPParamBlock xpp;
- CInfoPBRec cInfoRec;
- char buffer[1000], cmd[9];
- OSErr err;
- long *did, afpreturns, MyCurDir;
- short xppRNum, *vid;
- Boolean done;
-
-
- /* directid is OBNOXIOUSHIGHNUMBER only if I want to know if this is an AFS directory */
-
- if ( directid == OBNOXIOUSHIGHNUMBER ) MyCurDir = 2L;
- else {
-
- // cursor should be a spinning watch at this point....
- LDoDraw( false, gnegAcls );
- LDoDraw( false, gourList );
- SpinCursor( 8 );
- if ( gTopLevel == 0 ) {
- MyCurDir = 2L; /* root directory of a vol is 2 */
- } else {
- MyCurDir = directid;
- }
- }
-
- // here's my attempt to get the vcb
- vcb = (AVCB*)0x0358;
- done = false;
- while ((vcb != 0L) && !done)
- {
- if (vcb->vcbVRefNum == volRefNum)
- {
- if (vcb->vcbFSID != 0)
- done = true;
- else
- vcb = (AVCB*)vcb->qLink;
- }
- else
- vcb = (AVCB*)vcb->qLink;
- }
-
- SpinCursor( 8 );
- cInfoRec.dirInfo.ioNamePtr = (StringPtr) &foldName;
- cInfoRec.dirInfo.ioVRefNum = volRefNum;
- cInfoRec.dirInfo.ioFDirIndex = -1;
- cInfoRec.dirInfo.ioDrDirID = MyCurDir;
- PBGetCatInfo(&cInfoRec,false);
-
- bzero( buffer, 1000L);
- bzero( (char *)&xpp, sizeof(XPPParamBlock));
- SpinCursor( 6 );
- if ( OpenXPP( &xppRNum ) != noErr ) {
- DebugStr("\p hey dude");
- }
-
- /* Set Up request. */
- cmd[0] = 100; /* the first cmd byte says "get acl" */
- cmd[1] = 0;
- vid = (short*)&cmd[2];
- did = (long*)&cmd[4];
-
- *did = MyCurDir;
- *vid = (short)vcb->vcbServerVol;
- cmd[8] = 2;
- cmd[9] = 0;
-
- xpp.XPP.sessRefnum = vcb->vcbSRefNum;
- xpp.XPP.ioRefNum = xppRNum;
- xpp.XPP.ioCompletion = 0L;
- xpp.XPP.csCode = 250;
- xpp.XPP.aspTimeout = 2;
- xpp.XPP.cbSize = 10;
- xpp.XPP.cbPtr = cmd;
- xpp.LOGIN.rbSize = 1000;
- xpp.LOGIN.rbPtr = buffer;
-
- err = AFPCommand(&xpp, false); /* do a test for noErr!!!!!!!!!!! */
- afpreturns = xpp.XPP.cmdResult;
- SpinCursor( 6 );
-
- if( directid == OBNOXIOUSHIGHNUMBER ){
- if( afpreturns == noErr ) return true;
- else return false;
- }
-
- if (afpreturns == noErr)
- {
- if (( gInitialize == kOff ) && ( ++gManyAcls == 1 )) {
- parseStr( buffer );
- }
- if ( gInitialize == kOn ) {
- parseStr( buffer );
- }
- return true;
- }
- /* else
- tell the user something went wrong */
- /* DebugStr("\pafp has an error..."); I get this when a volume is down */
- // SysBeep( 0 ); nyahh.. we'll deal with it later...
- return false;
- }
-
- void instagroovyAcls( short whatoption ){
-
- /* comes from doMenu with the user selecting a certain cool access privilege s/he'd like
- to put on an acl name that they have permission to do.... */
-
- Cell where, // what directory/volume name?
- cSize = {0, 0}; // what group/user name?
- short objSize, focus, whatrow, permSize,
- value; // the sum of which equals the access
- int i, j;
- char k, right, objectName[256];
-
- where.h = 0;
- where.v = 0;
- if ( !LGetSelect( true, &where, dirList )) {
- LSetSelect( true, where, dirList );
- }
- whatrow = where.v;
-
- if ( whatoption == 1 ) value = 9; // = read + lookup
- if ( whatoption == 2 ) value = 12; // = insert + lookup
- if ( whatoption == 3 ) value = 63; // = everything except permit
- if ( whatoption == 4 ) value = 127; // = everything
-
- if ( gWindowstats.Focus == 1 ) focus = 1;
- if ( gWindowstats.Focus == 2 ) focus = 2;
- if ( gWindowstats.Focus == 0 ) {
- if ( LGetSelect( true, &cSize, gourList ) == false ) {
- if ( LGetSelect( true, &cSize, gnegAcls ) == false ) return;
- focus = 2;
- } else focus = 1;
- cSize.h = 0;
- cSize.v = 0;
- }
-
- objSize = 255;
-
- if( focus == 2 ) LGetSelect( true, &cSize, gnegAcls );
- else LGetSelect( true, &cSize, gourList );
- cSize.h = 0;
-
- if ( focus == 2 ) LGetCell(&objectName, &objSize, cSize, gnegAcls );
- else LGetCell(&objectName, &objSize, cSize, gourList);
-
- if (objSize != 0)
- {
- /* Get the permission string. */
- cSize.h = 1;
- permSize = 1;
-
- if ( focus == 2 ) LGetCell(&right, &permSize, cSize, gnegAcls);
- else LGetCell(&right, &permSize, cSize, gourList);
- i = right;
- if ( i < 0) { /* negative?? */
- sneakyNegative ( i );
- }
-
- /* and then reset it */
- j = 1;
- k = value; // just replace whatever is in there now with our new value
- if ( focus == 2 ) LSetCell(&k, j, cSize, gnegAcls );
- else LSetCell(&k, j, cSize, gourList);
- gAChange = whatrow+1;
- } else genericErrorstuff( -66670, kOn, 20 ); /* we should never be in here... */
- showRights( cSize.v );
- }